[R] read.spss and time/date information

Peter Dalgaard p.dalgaard at biostat.ku.dk
Wed Mar 3 19:47:27 CET 2004


Frank E Harrell Jr <feh3k at spamcop.net> writes:

> Speaking of read.spss, which I have found handles labels and value labels
> very well, I am having a difficulty with character variables ending up as
> factors even when the number of levels equals the number of observations. 
> I would be nice to have an option to keep character variables as-is (the
> sas.get function in Hmisc provides many options for this).

Will the max.value.labels not help? (otherwise, as.character should)

BTW, we seem to have a bug:

x <- read.spss(
  "/home/pd/R-1.8.1/tests/Packages/foreign/tests/electric.sav",
   max=1)
x$FAMHXCVR

gives

  [1] "Y" "N" "N" "Y" "N" "N" "N" "N" "N" "Y" "Y" "N" "Y" "Y" "Y" "N" "N" "N"
...
[235] "N" "N" "N" "N" "N" "N"
attr(,"value.labels")
       YES         NO
"Y       " "N       "

but a higher level of max gives all NA. Looks like trailing blanks in
value labels isn't handled right.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907




More information about the R-help mailing list