You can try paste and "[" (or "[[", depends on your needs).

x <- list(sim = 1:3)
x[paste("sim", 1, sep = "")]

Cheers,
Roman

p.s.
What you're trying to do seems a bit "hacky". What exactly are you trying to
achieve, maybe there's a more elegant solution?





On Wed, Aug 24, 2011 at 5:15 PM, Quets Jan <Jan.Quets@ua.ac.be> wrote:

> 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
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>



-- 
In God we trust, all others bring data.

	[[alternative HTML version deleted]]

