Looking for variables in R
Recently, I have been working with big databases. After reading their codebooks (usually very long pdf files), I thought it would be useful to have a function to find variable names in R. I wrote a simply function that looks for variable names in data.frame and data.table objects.
Here an example:
Pretty useful, at least for me. You can also use regular expressions to get variables, for instance, something like lookvar(dat, "p5[0-2]_[a-z]+_2")
.