[R-sig-Geo] using 'for loop' for assigning saved function values of function envelope in spatstsat

Quets Jan Jan.Quets at ua.ac.be
Wed Aug 24 17:15:49 CEST 2011


Hello I would like to put the code at the end of the mail in a for loop like:

for (i in 1:999){
  sims[i][[1]] = attr(env,"simfuns")$???
}

This is obviously not a problem for the left side of the equations.
However I have no clue what should replace the sim1, sim2, ..., sim999
creating and using a list of strings with objects the strings 'sim1', 'sim2',..., 'sim999' does not work. 

env is a envelope from spatstat where the argument 'savefuns' is set to 'TRUE'

Anyone an idea how to do this?

Thanks,
Jan

sims=list()
sims[1][[1]] = attr(env,"simfuns")$sim1
sims[2][[1]] = attr(env,"simfuns")$sim2
sims[3][[1]] = attr(env,"simfuns")$sim3
sims[4][[1]] = attr(env,"simfuns")$sim4
sims[5][[1]] = attr(env,"simfuns")$sim5
sims[6][[1]] = attr(env,"simfuns")$sim6
sims[7][[1]] = attr(env,"simfuns")$sim7
sims[8][[1]] = attr(env,"simfuns")$sim8
sims[9][[1]] = attr(env,"simfuns")$sim9
sims[10][[1]] = attr(env,"simfuns")$sim10

. . .

sims[999][[1]]=attr(env,"simfuns")$sim999


More information about the R-sig-Geo mailing list