Peter,
There is a function called codebook as part of the memisc package that probably
does what you want.
See also the package vignette:
http://cran.r-project.org/web/packages/memisc/vignettes/anes48.pdf
library(memisc)
fn <- "NILT12w2.por"
dat <- spss.portable.file(fn)
codebook(dat)
names(dat)
description(dat)
I hope this helps.
Markus
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On Behalf Of Peter Maclean
Sent: 26 October 2013 21:37
To: r-help at r-project.org
Subject: Re: [R] Code Book from SPSS Data
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
https://urldefense.proofpoint.com/v1/url?u=http://www.ark.ac.uk/nilt/datasets/&k=VTIXiGvdT7U4yPSpeHcrHQ%3D%3D%0A&r=dUkLGPeM%2BYkyyiRRq50yGs%2BmEf8kG%2FyCNQPwZn%2FaQD0%3D%0A&m=GVKjmjUiiJIiVcY%2FZ%2B35UGhRSRtdr9OJQhLQUx7Ax7Q%3D%0A&s=4dfa4233895c7e2f635380b0f8392a989a28848049001908965f058667a15143
#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)?
Peter Maclean
Department of Economics
UDSM
----------------------------------------------------------------------
The information in this E-Mail and in any attachments is...{{dropped:19}}