I seem to be having trouble trying to sample a random row from each data frame in my list of data frames.
Here is the code for reproducing the list:
output <- list()
iterations <- 5
for(i in 1:iterations){
output[[i]] <- mtcars <- mtcars[sample(nrow(mtcars), size = 15, replace = FALSE), ]
}
After getting the list of data frames, my goal is to take a random row from each of the data frames then add the sampled rows to a numbered list each as data frames.
I think that I may have to use the "map" function but I am not sure how to go about doing this.
Any help at all would be greatly appreciated!