Martin Maechler
1998-Mar-27 14:33 UTC
R: did you know ``comment(.) and comment(.) <- ...''
I'm doing some systematic investigations about which functions are <primitive> in R (and which of these should be changed to .Internal(...))... I just discovered :> x <- 1:10 > comment(x)NULL> comment(x) <- "x is just a vector" > x[1] 1 2 3 4 5 6 7 8 9 10> attributes(x)$comment [1] "x is just a vector"> comment(x)[1] "x is just a vector" ---------- Who of you (besides Ross?) did know this feature. "comment" is an *INVISIBLE* (for printing) attribute you can give to anything, including functions and data.frames. Any volunteer for writing a Rdoc file "comment.Rd" (for `?comment' to work)? Martin -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> From r-devel-owner@stat.math.ethz.ch Sat Mar 28 02:30 NZS 1998 > Date: Fri, 27 Mar 1998 15:33:02 +0100 > From: Martin Maechler <maechler@stat.math.ethz.ch> > To: R-devel@stat.math.ethz.ch > Subject: R: did you know ``comment(.) and comment(.) <- ...'' > Mime-Version: 1.0 (generated by tm-edit 7.95) > > I'm doing some systematic investigations about which functions are > <primitive> in R (and which of these should be changed to .Internal(...))... > > I just discovered : > > > x <- 1:10 > > comment(x) > NULL > > comment(x) <- "x is just a vector" > > x > [1] 1 2 3 4 5 6 7 8 9 10 > > attributes(x) > $comment > [1] "x is just a vector" > > > comment(x) > [1] "x is just a vector" > > ---------- > Who of you (besides Ross?) did know this feature.You are making the assumption that I know about this :-). I do have a very vague memory of trying something like this as and experiment. Is it worth keeping? Ross -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._