note | R Documentation |
An alternative to the base::comment()
.
note(x) <- value
set_note(x, value)
note(x)
x |
An object |
value |
The note to attach; if |
When the note is assigned to an object a new class will be added,
note
, so that a print
function can call an S3 method. The print for
this can be adjusted for it's width by using the option mark.note.width
which defaults to the option width
when not set.
The type of object assigned to the note is not restricted, so user beware of odd prints or additional features added to the notes fun.
When assigning a note (with note<-
, and its alias set_note()
) the
noted
class is added to the object. This allows the print.noted
class
to be dispatched and for the note to be printed every time the object is
called/printed and the next print method used. However, it will not be
called when not interactive()
note<-
, set_note()
will return x
(with the "note"
attribute
assigned)
note()
will retrieve the "note"
attribute
x <- c("x", "k", "c", "d")
comment(x) <- "This is just a comment"
comment(x)
# Comment is intentionally hidden
x
note(x) <- "Just some random letters"
note(x)
# Note is now present every time
x
# Assigning `NULL` will remove note (and class)
note(x) <- NULL
note(x) # NULL
x # No more note
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.