[R] Code Book from SPSS Data

Peter Maclean
Sun, 27 Oct 2013 21:37:27 -0000

I am trying again. I do not have SPSS and I would like to create a code book in
a data frame format using R. I am reading the SPSS file using "memisc
package". The script is:
#Data for 2012 available at http://www.ark.ac.uk/nilt/datasets/
#Also attached
ibrary(memisc)
## change the working directory
getwd()
setwd('')
data <- spss.portable.file("NILT12w2.por")
Get names
names(data)
#Get Variable Lebels
des <- as.data.frame(description(data))
#Descriptive Statistics & Code Book
#Results are very long for printing
codebook(data)
#How could I extract a codebook (without Summary statistics for printing)?

The code book will have label value of label and description of labeld
For example, for gender

Variable      Code                        Description
Gender      1=Male                    Gender of respondent
                  2=Female
Status        1=Married                Marital status
                   2=Widow
                   3=Others

Peter Maclean
Department of Economics
UDSM



On Sunday, October 27, 2013 3:32 AM, Barry Rowlingson
<b.rowlingson@lancaster.ac.uk> wrote:

On Sat, Oct 26, 2013 at 9:37 PM, Peter Maclean <pmaclean2011@yahoo.com>
wrote:
> I do not have SPSS and I would like to create a code book in a data frame
format using R.

> #How could I extract a codebook (without Summary statistics for printing)?

This isn't that clear because I don't think 'codebook' is
something
well-defined. Describe the rows and columns of the data frame you want
to create.

Barry
	[[alternative HTML version deleted]]