Skip to content
Back to formatted view

Raw Message

Message-ID: <199803271433.PAA09656@sophie.ethz.ch>
Date: 1998-03-27T14:33:02Z
From: Martin Maechler
Subject: 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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._