[R] Creating a text codebook

Thomas Lumley tlumley at u.washington.edu
Thu Sep 30 19:31:20 CEST 2004

On Thu, 30 Sep 2004, Doran, Harold wrote:

> Is there a currently existing method in an R package for creating a
> codebook from a dataframe? Preferably, I would like to be able to export
> to a text file all relevant information.

There's something along these lines (though not quite what you want) in 
the latest version of the "foreign" package.

The function write.foreign writes out two text files, one of data and one 
of code to read those data into some other package. It currently handles 
SPSS and Stata, and  writeForeignSPSS writes out variable names and factor 
levels into the SPSS code file.  It doesn't handle more complicated things 
such as dates, though.


More information about the R-help mailing list