Frank E Harrell Jr <[EMAIL PROTECTED]> 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
~~~~~~~~~~ - ([EMAIL PROTECTED])             FAX: (+45) 35327907

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to