Skip to contents

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)

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.

Value

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

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().

Examples

# \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)
}
# }