I'm trying to generate N lists of randomly selected parameter values. Some of
the parameters are vectors while other are single values. I've tried to use the
approach below but it doesn't work for parameter x, which should be a vector.
Thanks in advance!
James
#Define names of parameters in the list,
parms<- list(
x=c(0,0),
y=0)
#Create N sets of randomly selected parameter values
N<- 10
set<-rep(list(parms),N)
for (i in 1:N) {
set[[i]]["x"]=c(runif(1,1,2), runif(1,2,3)) ###Problem here
set[[i]]["y"]=runif(1,5,10)
}
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.