Skip to content

Removes the metadata that haven uses to round-trip variables and data frames between R and SAS/SPSS/Stata (see meta()). This removes the haven_meta attribute as well as the legacy format.sas, format.spss, format.stata, display_width, and width attributes on columns and notes, creation_timestamp, and modified_timestamp attributes on data frames.

Variable labels, value labels, and user-defined missing values are not affected; use zap_label(), zap_labels(), and zap_missing() to remove those.

Usage

zap_meta(x)

Arguments

x

A vector or data frame.

Examples

x <- 1:3
meta(x) <- meta_var_sas(format = "BEST12.")
meta(x)
#> <haven::meta_var_sas>
#> @format: "BEST12."
meta(zap_meta(x))
#> NULL

# zap_meta() also works with data frames, removing metadata from the
# data frame and every column
df <- tibble::tibble(x)
meta(df) <- meta_df_sas(table_name = "DATA")
df <- zap_meta(df)
meta(df)
#> NULL
meta(df$x)
#> NULL