[R] The assign(paste(...,i),...) idiom

Thomas Lumley tlumley at u.washington.edu
Tue Apr 21 01:41:19 CEST 2009


On Mon, 20 Apr 2009, Stavros Macrakis wrote:

> Judging from the traffic on this mailing list, a lot of R beginners
> are trying to write things like
>
>      assign( paste( "myvar", i), ...)
>
> where they really should probably be writing
>
>      myvar[i] <- ...
>
> Do we have any idea where this bizarre habit comes from?
>

I think it comes from the macro languages in SAS and Stata (and perhaps SPSS) where this sort of thing is a natural idiom.

     -thomas

Thomas Lumley			Assoc. Professor, Biostatistics
tlumley at u.washington.edu	University of Washington, Seattle




More information about the R-help mailing list