A format catalog is a collection of formats. A format collection allows you to manage and store formats as a unit. The fcat function defines the format catalog.

fcat(..., log = TRUE)



A set of formats. Pass the formats as a name/value pair. Multiple name/value pairs are separated by a comma.


Whether to log the creation of the format catalog. Default is TRUE. This parameter is used internally.


The format catalog object.


A format catalog is an S3 object of class "fcat". The purpose of the catalog is to combine related formats, and allow you to manipulate all of them as a single object. The format catalog can be saved to/from a file using the write.fcat and read.fcat functions. A format catalog can also be converted to/from a data frame using the as.fcat.data.frame and as.data.frame.fcat functions. Formats are accessed in the catalog using list syntax.

A format catalog can be used to assign formats to a data frame or tibble using the formats function. Formats may be applied using the fdata and fapply functions.

A format catalog may contain any type of format except a formatting list. Allowed formats include a formatting string, a named vector lookup, a user-defined format, and a vectorized formatting function. A formatting list can be converted to a format catalog and saved independently. See the flist function for more information on formatting lists.

See also

formats function for assigning formats to a data frame, and the fdata and fapply functions for applying formats.

Other fcat: as.data.frame.fcat(), as.fcat.data.frame(), as.fcat.fmt_lst(), as.fcat.list(), as.fcat(), is.fcat(), print.fcat(), read.fcat(), write.fcat()


# Create format catalog
c1 <- fcat(num_fmt  = "%.1f",
           label_fmt = value(condition(x == "A", "Label A"),
                             condition(x == "B", "Label B"),
                             condition(TRUE, "Other")),
           date_fmt = "%d%b%Y")

# Use formats in the catalog
fapply(2, c1$num_fmt)
fapply(c("A", "B", "C", "B"), c1$label_fmt)
fapply(Sys.Date(), c1$date_fmt)