[R] Please help with write.foreign(SPSS)
Jim Lemon
jim at bitwrit.com.au
Tue Dec 7 12:07:03 CET 2010
On 12/07/2010 09:42 PM, He wrote:
> Hi Jim,
>
> Thank you so much for your suggestion. I have tried ".csv" and ".sav".
> ".sav" works better. I learned "DAT file" from the internet. There
> were some similar discussion about wirte.foreign() before.
>
> I don't really know how the transfermation of the files between R and
> SPSS works. When i got several files, I was a little lost.
>
> But I should emphasize my main problem which is the character variable
> is not read shown up in the file. I mean i want to see e.g., 000CF7CC
> in the data instead of its corresponding value 1 defined by SPSS
> automatically. Another problem is how to keep the variable names in
> the "data file".
>
Normally, when you write out a data file in SPSS format from R, it
should correspond to an SPSS "system" or .SAV file. I would expect to
see something like this:
library(foreign)
write.spss(df,file="k:/res.sav")
Then in your SPSS file:
GET /FILE="k:\res.sav".
I don't think the .SAV extension is necessary, but I'm not sure.
Jim
More information about the R-help
mailing list