fmt: Assign or Retrieve Data Format

fmtR Documentation

Assign or Retrieve Data Format

Description

Functions to assigns or retrieve data formatting information to and from an object.

Usage

fmt(x, ...)

Arguments

x

Target object.

...

Other arguments (not used).

y

Character string(s) specifying the name(s) of the variables or attributes to be assigned data formats.

value

Character string(s) specifying the data format to be assigned.

Details

Named argiments in the format that are not in the target object are ignored. The fmt attribute may be erased by assigning a NULL or empty string "" value to it.

Value

Object with a format fmt attribute attached to it.

Functions

fmt

Generic fmt method.

fmt.default

Default fmt method.

fmt<-

Generic format assignment method.

fmt<-.default

Default format assignment method. See Examples for usage.

See Also

metadata

Examples

x <- data.frame(year = 2010:2014, month = 6, day = 1:5, measurement = rnorm(5))
fmt(x, "year")  <- "YYYY"
fmt(x, "month") <- "MM"
fmt(x, "day")   <- "DD"

# Equivalently:
fmt(x) <- c(year = "YYYY", month = "MM", day = "DD")
fmt(x, c("year", "month", "day")) <- c("YYYY", "MM", "DD")

# Show attributes:
attributes(x)
fmt(x)

# Erase 'fmt' attribute:
fmt(x) <- NULL


TobieSurette/gulf.metadata documentation built on Dec. 31, 2022, 5:35 a.m.