Learn R Programming

DDIwR (version 0.24)

vendorMetadata: Read and edit vendor-specific metadata

Description

Accesses statistical metadata without editing attributes directly. Replacement returns a modified object and preserves unrelated metadata and values.

Usage

vendorMetadata(x, vendor, field = NULL)

vendorMetadata(x, vendor, field = NULL) <- value

Value

The metadata list or field; replacement returns the modified object.

Arguments

x

An R vector or data frame.

vendor

Statistical vendor.

field

One field name, or NULL for the whole list.

value

Replacement field value or named metadata list.

Details

vendor is "SPSS", "Stata" or "SAS" (case insensitive). With no field, the getter returns the stored vendor list. With a field, it returns that field, falling back to legacy format/width/display-width/notes attributes only when the field is absent. A stored NULL suppresses that fallback.

Replacing one field with NULL stores an explicit clearing marker; it does not delete the field. Replacing the whole list with NULL removes that container, allowing legacy fallback again. Use clearFormats() or clearWidths() to remove the corresponding fields and legacy attributes together. Replacement validates list structure; field values are validated by the destination writer. Dataset and column metadata use the same interface. The function does not traverse data-frame columns: select a column explicitly to edit its metadata.

Examples

Run this code
x <- c(1, 2)
vendorMetadata(x, "SAS", "format") <- "BEST12."
vendorMetadata(x, "SAS", "informat") <- "BEST32."
vendorMetadata(x, "SAS", "format")
vendorMetadata(x, "SAS", "format") <- NULL

Run the code above in your browser using DataLab