Import a SAS/SPSS/Systat/Stata dataset
You want to import an SPSS dataset into R
Datasets stored by the SPSS "save" and "export" commands can be read by the
read.spss function from the
foreign package. To read an SPSS dataset saved in the
spssfilename.sav file we use
the following command in R:
> library(foreign) > indata <- read.spss("spssfilename.sav", to.data.frame = TRUE)
read.systathave the same functionality and are used to import SAS xport datasets, Stata datasets, and Systat datasets, respectively.
See rules 1.10, 1.11, 1.12, and 1.13 in The R Primer for more information.
Back to tips.