| meta | R Documentation |
meta() gets and sets the metadata attached to a vector or data frame
by read_sas(), read_spss(), or read_stata(). The metadata is stored
in a single haven_meta attribute holding an S7 object whose class
depends on the vendor and on whether x is a data frame:
Column metadata: meta_var_sas, meta_var_spss, meta_var_stata.
Data frame metadata: meta_df_sas, meta_df_spss, meta_df_stata.
If no metadata has been set, meta() falls back to the legacy
format.*, display_width, width, notes, and *_timestamp
attributes, so objects saved by older versions of haven keep working.
meta(x, vendor = NULL)
meta(x, vendor = NULL) <- value
x |
A vector or data frame. |
vendor |
If supplied, one of |
value |
|
meta() returns an S7 object inheriting from meta_var (for
vectors) or meta_df (for data frames), or NULL.
df <- read_sav(system.file("examples", "iris.sav", package = "haven"))
# Data frame metadata
meta(df)
meta(df)@created
# Column metadata
meta(df$Species)
meta(df$Species)@format
# Modify metadata
meta(df$Species)@measure <- "ordinal"
meta(df$Species)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.