I want to create an empty list to replace its elements with other lists.
for instance
simulations = 10 seeds = sample(10000:99999, simulations, replace=F) test_function <- function(seedX){ lista = list(seedX=seedX, dataframe=data.frame(x=runif(10, -5.0, 5.0),y=rnorm(10,mean = 0,sd = 1))) return(lista) } results <- vector("list", simulations) results[1] = test_function(seedX = seeds[1])
I get the following error:
Warning message: In results[1] = test_function(seedX = seeds[1]) : number of items to replace is not a multiple of replacement length
What am I doing wrong?
Thanks!
source share