1) We didn't get the attachment. The allowed types are given in the
posting guide and are pretty restrictive: the suggestion is to put binary
files on the web for download.
2) We don't have the version information asked for in the posting guide. I
would only expect this to work in foreign 0.8-29 or 0.8-30. If you are
using one of those, please send me the file directly and I will take a
look at what is happening.
3) Since you have the value labels attribute you can use it to change the
second column into a factor. Again, without more details I cannot tell
you exactly what is needed.
On Tue, 23 Dec 2008, Andrew Choens wrote:
I am trying to import a SPSS.sav file into R. The attached file is not
technically the file I am trying to import, but does replicate my
problem. The actual file is much too large to attach. No matter what I
do, I can not get R (base or Hmisc) to apply the value labels in
the .sav file to the dataframe created in R. Here's the code that I am
using.
maine <- spss.get("test.sav")
# or
maine2 <- read.spss("test.sav", read.value.labels=TRUE)
When I try to import the file, the value labels are not assigned to the
rows. This is what I get.
ID GENDER
1 1 1
2 2 2
3 3 1
4 4 2
5 5 1
6 6 1
7 7 1
8 8 2
9 9 2
10 10 1
11 11 3
In the .sav file, 1 = Men 2 = Women 3 = user assigned missing.
The variable values are attached as a value.labels attribute. If I
remove row # 11 (gender = 3), I can import the file as I expect.
ID GENDER
1 1 Men
2 2 Women
3 3 Men
4 4 Women
5 5 Men
6 6 Men
7 7 Men
8 8 Women
9 9 Women
10 10 Men
Given all of this: How can I import a .sav file with user assigned
missing values correctly.
If this is not possible, what is the best way to use the value.labels
attribute when I make a table with table(Gender).
Thanks.
--
Insert something humorous here. :-)
--
Brian D. Ripley, rip...@stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.