[R] Combined variable names
Douglas Bates
bates at stat.wisc.edu
Wed Dec 1 17:07:29 CET 2004
Richard A. O'Keefe wrote:
> Tobias Muhlhofer <t.muhlhofer at lse.ac.uk> wrote:
> I am trying to define a large number of variables through a loop
> construct.
>
> He wants to do
> for (i in 1:100) {
> assign(paste("v", i, sep=""), ....something or other...)
> }
>
> This is, of course, a FAQ. It's such a FAQ that I must have seen it
> once a day for the last several days.
>
> What I want to know is *WHY* people are doing this?
> What, precisely, does it buy you to have variables called v1...v100
> rather than variables called v[[1]]...v[[100]]?
> Apart from persistent inconvenience, that is?
I believe it is an SPSSism. It has been many, many years since I last
used SPSS but I vaguely recall a facility for specifying ranges of
columns in the form x1-x99.
Duncan Temple Lang's sig file used to have a quote something like
"Language shapes the way we think" and that applies here.
More information about the R-help
mailing list