This below code generates 5 random items from list without replacement.

boxno <- c("C1","C2","C3","C4","C6","C7","C8","C9","C10","D1","D4","D5","D7","D9","D10") # the list you would like to choose from
set.seed(1904)   # any seed number so that you will get same results everytime you run it 
sample <- split(sample(boxno), rep(1:(length(boxno)/5), each=5)) # the first part of code randomizes the list, the "split" function splits the randomized list into three separate list containing 5 items 
sample # prints the output

The below code outputs duration of all audio files in a folder into a speadsheet.
Note: You can output any of the property of audio file e.g. duartion, amplitude etc. Please refer to soundgen library.

library(tuneR)          #install both packages if you have not already
audio<-readWave("C:/Users/Prateek Sahu/Desktop/Vocalisation/males/GraGra0201_110701-DC-36f.wav", header=TRUE) # reading the wave file and storing in "audio"
audio$samples / audio$sample.rate  # length of audio file for a single file

## The below code is for a folder containing multiple audio files
fnam=file.path("C:/Users/Prateek Sahu/Desktop/Vocalisation/males") #file path of the folder
filist=list.files(fnam, recursive=TRUE, pattern="wav") # file list 
filist1=paste(fnam, "/", filist, sep="")
test_length=c("Full File Path", "length") #some formating for pasting below time duration 
for (i in 1:nfiles){
  inname <- filist1[i]
  audio <- readWave(inname, header = TRUE)
  L<- round(((audio$samples / audio$sample.rate) * 1000),2)
  test_length <- rbind(test_length, c(inname, L))
# the for loop goes through all files of the folder and calculate the length of the audio 
library(openxlsx)  # try not to use the library "xlsx" as it has java dependency 
write.xlsx(test_length, "C:/Users/Prateek Sahu/Desktop/Vocalisation/males/length.xlsx")
# this writes the all duration of audio files in the xlsx file format (or csv; whatever you like)