How to use read.spss() Function of foreign Package In R Language
To read SPSS files in R we use read_spss() function. To do so we firstly install foreign package using:
install.packages("foreign")
Then, import foreign package in R code and using read_spss() function read SPSS files.
Syntax:
read_spss(“FileName.sav”, to.data.frame = BOOLEAN)
Example: Reading SPSS file
R
# import foreign package library ( "foreign" ) # Read SPSS file using read.spss() function dataframe <- read.spss ( "SPSS.sav" , to.data.frame = TRUE ) dataframe |
Output:
Read SPSS sav File into R
In this article, we are going to see how to read SPSS .sav File in R programming language. The SPSS Statistics File Format is a proprietary binary format, developed and maintained as the native format for the SPSS statistical software application.