[R] Documenting variables, dataframes and files?

David Winsemius dwinsemius at comcast.net
Wed Jun 22 17:52:51 CEST 2011


There is a 'comment' function. It sets an attribute which gets carried  
along with the dataframe when it is saved or copied:

 > df1 <-data.frame(NA)
 > df1
   NA.
1  NA
 > comment(df1) <- "empty dataframe"
 > comment(df1)
[1] "empty dataframe"
 > df2 <- df1
 > comment(df2) <- c(comment(df1), "copy of df1")
 > comment(df2)
[1] "empty dataframe" "copy of df1"
 > comment(df1) <- c("empty dataframe", summary(df1))
 > comment(df1)
[1] "empty dataframe" "Mode:logical  "  "NA's:1        "


On Jun 22, 2011, at 10:57 AM, Robert Lundqvist wrote:

> Every now and then I realize that my attempts to document what all  
> dataframes consist of are unsufficient. So far, I have been writing  
> notes in an external file. Are there any better ways to do this  
> within R? One possibility could be to set up the data as packages,  
> but I would like to have a solution on a lower level, closer to  
> data. I can't find any pointers in the standard manuals. Suggestions  
> are most welcome.
>
> Robert
>
> **********************
> Robert Lundqvist
> Norrbotten regional council
> Sweden
>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list