Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Assign note to R dataframe variables

Tags:

r

attributes

Is it possible to assign notes to a variable in an R dataframe? This is possible in Stata and SPSS.

like image 406
Masood Sadat Avatar asked Oct 21 '25 01:10

Masood Sadat


1 Answers

You can assign a comment as an attribute using the comment function.

x <- 1:5

# assign a comment
comment(x) <- 'this is a test comment'


# return a comment
comment(x)

[1] "this is a test comment"

str(x)

 int [1:5] 1 2 3 4 5
 - attr(*, "comment")= chr "this is a test comment"

Some additional info can be found here

like image 76
Mako212 Avatar answered Oct 22 '25 14:10

Mako212



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!