RINNER Heinrich wrote:

In R:

library(foreign)
test <- read.spss("test.sav", to.data.frame=T)
test

XCHAR
1 a 2 ab 3 abcde


levels(test$XCHAR)

[1] "a " "ab " "abcde"


Shouldn't it rather be "a" "ab" "abcde" (no blanks)?

I think, that should be no problem since the blanks in XCHAR may be easily removed with gsub()


If you have
> s<-c("a    ","ab   ","ab cd ")

then
> gsub(" ","",s)
[1] "a"    "ab"   "abcd"

removes all spaces or

> gsub(" *$","",s)
[1] "a"     "ab"    "ab cd"

removes all trailing spaces.

Hope this helps!

Thomas P.

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to