Learn R Programming

mariposa (version 0.7.3)

read_por: Read SPSS Portable Data with Tagged Missing Values

Description

Reads an SPSS portable .por file and preserves user-defined missing values as tagged NAs. This is the portable format equivalent of read_spss() for .sav files.

Usage

read_por(path, tag_na = TRUE, verbose = FALSE)

Value

A tibble with the SPSS data. See read_spss() for details on tagged NA handling.

Arguments

path

Path to an SPSS .por file.

tag_na

If TRUE (the default), user-defined missing values are converted to tagged NAs using haven::tagged_na(). If FALSE, the file is read with standard haven::read_por() behavior.

verbose

If TRUE, prints a message summarizing how many values were converted.

Details

The SPSS portable format (.por) is an older, platform-independent format. Unlike .sav files, the portable format does not support specifying a character encoding. Tagged NA handling is identical to read_spss().

See Also

read_spss(), na_frequencies(), untag_na(), strip_tags(), haven::read_por()

Other data-import: na_frequencies(), read_sas(), read_spss(), read_stata(), read_xlsx(), read_xpt(), strip_tags(), untag_na()

Examples

Run this code
# \donttest{
# .por files cannot be produced from R, so this only runs when one
# is present in the working directory
if (requireNamespace("haven", quietly = TRUE) &&
    file.exists("survey.por")) {
  data <- read_por("survey.por")
  na_frequencies(data$satisfaction)
}
# }

Run the code above in your browser using DataLab