Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

1. R Basics > Loading Data from an SPSS File

Loading Data from an SPSS File

Problem

You want to load data from an SPSS file.

Solution

The foreign package has the function read.spss() for reading SPSS files. To load data from the first sheet of an SPSS file:

# Only need to install the first time
install.packages("foreign")

library(foreign)
data <- read.spss("datafile.sav")

Discussion

The foreign package also includes functions to load from other formats, including:

  • read.octave(): Octave and MATLAB
  • read.systat(): SYSTAT
  • read.xport(): SAS XPORT
  • read.dta(): Stata

See Also

See ls("package:foreign") for a full list of functions in the package.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint