Learn R Programming

bulkreadr (version 1.2.0)

read_spss_data: Read SPSS data file

Description

read_spss_data() is designed to seamlessly import data from an SPSS data (.sav or .zsav) files. It converts labelled variables into factors, a crucial step that enhances the ease of data manipulation and analysis within the R programming environment.

Usage

read_spss_data(file, label = FALSE)

Value

A tibble containing the data from the SPSS file.

Arguments

file

The path to the SPSS data file.

label

Logical indicating whether to use variable labels as column names (default is FALSE).

See Also

read_stata_data() which reads Stata data file and converts labelled variables into factors.

Examples

Run this code
# Read an SPSS data file without converting variable labels as column names

file_path <- system.file("extdata", "Wages.sav", package = "bulkreadr")

data <- read_spss_data(file = file_path)

data

# Read an SPSS data file and convert variable labels as column names

data <- read_spss_data(file = file_path, label = TRUE)

data

Run the code above in your browser using DataLab