Re: [R] SPSS variable lables import

From: Frank E Harrell Jr <>
Date: Wed 07 Jun 2006 - 01:55:50 EST

Thomas Lumley wrote:
> On Tue, 6 Jun 2006, Frank Thomas wrote:

>>I try to get the variable labels of a SPSS data file into R but don't
>>find this mentioned in the help file for foreign. Is there another way
>>to get them ?
>>BTW: An SPSS variable name is like: VAR001, whereas the variable label
>>might be 'Identification no.'

> mydata <- read.spss("mydata.sav")
> attr(mydata, "variable.labels")
> -thomas


mydata <- spss.get('mydata.sav')
xYplot( )
etc. use the variable labels attached to individual variables. You can retrieve them also this way:

with(mydata, plot(x, y, xlab=label(x), ylab=label(y)))

Frank Harrell

> Thomas Lumley Assoc. Professor, Biostatistics
> University of Washington, Seattle
> ______________________________________________
> mailing list
> PLEASE do read the posting guide!

Frank E Harrell Jr   Professor and Chair           School of Medicine
                      Department of Biostatistics   Vanderbilt University

______________________________________________ mailing list
PLEASE do read the posting guide!
Received on Wed Jun 07 02:58:43 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 07 Jun 2006 - 04:10:39 EST.

Mailing list information is available at Please read the posting guide before posting to the list.