On 06-Dec-07 12:04:56, Søren Højsgaard wrote: > Dear all, > Starting from a recent version of R, the $ became "unusable" > on atomic vectors, e.g. >> x <- c(a=1,b=2) >> x$a > NULL > Warning message: > In x$a : $ operator is invalid for atomic vectors, returning NULL > > I can of course do >> x['a'] > - but that requires more typing (5 characters rather than 2). > > Apologies if I've missed a an announcement regarding this, but > 1) Is there an alternative to the ['a'] and > 2) Why was this change made?
While Brian has answered your query from a more technical point of view, there's an implication you should consider. x$a always (as far as I know)[*] has been "unusable", in that it returns NULL, and not what you expected to get. The only thing that's (relatively) new is that you now get a warning. [*] Certainly as early as R-1.6.2 (Jan 2003), as I've just checked. Previously, you were not getting a warning. So, if you were using the likes of x$a in code, and getting no warnings, possibly your code was generating results derived from NULL values rather than from the values you expected it to be using. Perhaps you should check back! Best wishes, Ted. -------------------------------------------------------------------- E-Mail: (Ted Harding) <[EMAIL PROTECTED]> Fax-to-email: +44 (0)870 094 0861 Date: 06-Dec-07 Time: 12:39:49 ------------------------------ XFMail ------------------------------ ______________________________________________ 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.