Reputation: 1337
Is it possible to assign notes to a variable in an R dataframe? This is possible in Stata and SPSS.
Upvotes: 4
Views: 526
Reputation: 7312
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
Upvotes: 5