Message-ID: <124CBC30-4322-11D9-8962-000D933565E8@mail.nih.gov>
Date: 2004-11-30T22:49:19Z
From: Sean Davis
Subject: Combined variable names
In-Reply-To: <41ACF742.1020408@lse.ac.uk>
See the R-FAQ here:
http://cran.r-project.org/doc/FAQ/R-FAQ.html
Number 7.21.
However, as the FAQ also points out, you might be better served using
lists.
a <- list()
for (i in 1:100) {
a[[i]] <- some stuff
}
Sean
On Nov 30, 2004, at 5:42 PM, Tobias Muhlhofer wrote:
> I am trying to define a large number of variables through a loop
> construct.
>
> I have my loop variable i being cycled through 1:100 and I would like
> the variables produced by this to be called
>
> vi (i.e. v1 v2 v3 etc)
>
> so, for example I'm going:
>
> for(i in 1:100) {
>
> <blank> <- a[i:N] # or whatever else you want to put on the right side
>
> }
>
> where N is previously defined.
>
> What goes in for <blank>?
>
> Thanks,
> Toby
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html