The following works just fine for me, using the built-in SPSS dataset nhis2000_subset.sav.
library(foreign) a=read.spss("C:\\Program Files\\IBM\\SPSS\\Statistics\\21\\Samples\\English\\nhis2000_subset.sav", to.data.frame=T) names(a) [1] "STRATUM" "PSU" "WTFA_SA" "SEX" "AGE_P" "REGION" "SMKNOW" "VITANY" "VITMUL" "HERBSUPP" "VIGFREQW" [12] "MODFREQW" "STRFREQW" "DESIREWT" "MOVE1" "LIFT" "age_cat" You do not need to specify a comma delimiter on your read.spss statement since the file is already in a native SPSS dataset format -- not a CSV file. --Mark Lamias ________________________________ From: F86 <farad...@gmail.com> To: r-help@r-project.org Sent: Monday, December 3, 2012 10:55 AM Subject: [R] How to read SPSS file in R Dear R-users, I have som troubles with .sav file. How is it possible for us R-users to read SPSS files. I know that is possible, I tried the following: > library(foreign) > Corp<-read.spss("/Users/kama/Analysis/Corporation.sav", header=TRUE, > sep=",") Error in read.spss("/Users/kama/Analysis/Corporation.sav", header = TRUE, : unused argument(s) (header = TRUE, sep = ",") > Corp<-read.spss("/Users/kama/Analysis/Corporation.sav") re-encoding from UTF-8 Any suggestions please? Regards, Faradj Stockholm University -- View this message in context: http://r.789695.n4.nabble.com/How-to-read-SPSS-file-in-R-tp4651896.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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. [[alternative HTML version deleted]]
______________________________________________ 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.