Dear all, I get stuck when i try to export the data into SPSS format/file using "write.foreign()" Do you know how to do it exactly?
What i have done is 1) First i type the following code in R: df<-data.frame(id,year,res1) names(df)<-c("idcode","year","resarrvl") write.foreign(df,"z:/daten/res.dat","z:/daten/res.sps",package="SPSS") 2) Then I run "res.sps" in SPSS DATA LIST FILE= "k:/res.dat" free (",") / idcode year resarrvl . VARIABLE LABELS idcode "idcode" year "year" resarrvl "resarrvl" . VALUE LABELS / idcode 1 "000CF7CC" 2 "000D0212" 3 "000D055F" ...... 1339 "06996BC5" 1340 "069972BF" . EXECUTE. 3) After running this file, there automatically appears a SPSS file. The variable name is correct, however, there is no data in that file. The character variable id has different "values" like 1.00 = "000CF7CC", where 000CF7CC should be in the tab of data view instead of variable view. 4) Try to open "res.dat" It comes out the window "Text import wizard" The first column which should be the vairable id, shows only the "values" of id, i.e. 1, 2 and so on. And no real variables names. Thank you for any suggestion. Best wishes, He ______________________________________________ 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.