Perhaps a good R WIKI topic, though there's no assurance that info there would be consulted, of course...
Bert Gunter Genentech Nonclinical Biostatistics 650-467-7374 -----Original Message----- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of baptiste auguie Sent: Monday, April 20, 2009 3:07 PM To: Stavros Macrakis Cc: r-help Subject: Re: [R] The assign(paste(...,i),...) idiom I vaguely recall thinking with such convoluted constructs when switching from Matlab to R. The lack of generic data structures such as lists makes you define variable names that you can identify and manipulate. There are structures in Matlab, but I think they are much less used than lists in R. I was wondering earlier how to help newcomers understand the limitations of this strange and unnecessary construct without going through the details of each particular example that comes up in the r- help list. Perhaps a simple generic and illustrative example in the R wiki? (say, (i) list some data files in a directory, (ii)load into data.frames, (iii)manipulate some columns, (iv)store in a list, (v)manipulate the list, (vi)plot some results). Now, how would we go about naming that entry...? Perhaps 'A beginner's assignment' baptiste On 20 Apr 2009, at 22:44, 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? > > -s > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. _____________________________ Baptiste AuguiƩ School of Physics University of Exeter Stocker Road, Exeter, Devon, EX4 4QL, UK Phone: +44 1392 264187 http://newton.ex.ac.uk/research/emag ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.