Created
October 7, 2015 16:08
-
-
Save sahilseth/f8a7ed851dafe0e8064d to your computer and use it in GitHub Desktop.
add complex variable names to a data.frame
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df = data.frame(id = 1:10, fname = paste0("name", 1:10)) | |
nms = c(id = "the unique id which does this or that", | |
fname = "first name of a person") | |
attr(df, 'info') <- nms | |
## let is see how this looks | |
attr(df, "info") | |
## show a pretty table | |
library(knitr) # OR library(params) | |
kable(df, col.names = attr(df, "info")) |
Author
sahilseth
commented
Oct 7, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment