Chcę utworzyć pustą listę, aby można było zastąpić jej elementy innymi listami.utwórz pustą listę, aby uzupełnić listę w R
Na przykład
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])
pojawia się następujący błąd:
Warning message:
In results[1] = test_function(seedX = seeds[1]) :
number of items to replace is not a multiple of replacement length
Co robię źle?
Dzięki!