R: did you know ``comment(.) and comment(.) <- ...''

Martin Maechler Martin Maechler <maechler@stat.math.ethz.ch>
Fri, 27 Mar 1998 15:33:02 +0100


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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._