Is there a way to set an object's attribute such that the attribute does not print to console when the object is called (but which still allows the attribute to be inspected when attributes() is called on the object)?
E.g. if x is given a random attribute
x <- 1:5
attr(x, 'some_attribute') <- "value of the attribute"
we can inspect the attribute
attributes(x)
$some_attribute
[1] "value of the attribute"
but the attribute also prints to console when the object is called
x
[1] 1 2 3 4 5
attr(,"some_attribute")
[1] "value of the attribute"
Is there a way to set an attribute so that it doesn't print to console when the object is called?
That is (from the example above) such that x prints without the attribute(s) set for it
x
[1] 1 2 3 4 5
You want the comment attribute:
https://stat.ethz.ch/R-manual/R-devel/library/base/html/comment.html
comment(x) <- "This value won't print."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With