The fmtr package contains functions to format vectors and data frames.
The fmtr package helps format data frames, similar
to the way datasets are formatted in SAS®. Formats are assigned
to columns using a format attribute. Formats are then applied
by calling the
fdata function on the data frame.
function returns a new data frame with the formats applied to each column
All functions in the
fmtr package also work with tidyverse tibbles.
The fmtr package also contains a function named
value for defining user-defined formats in a manner
similar to SAS® formats.
The main functions included in the fmtr package are as follows:
fdata: Applies formatting
to a dataframe.
fapply: Applies formatting
to a vector.
fcat: Creates a format catalog.
value: Creates a new
formats: Helps assign format attributes
to a data frame.
fattr: Helps assign formatting attributes
to a vector.
The formats that can be used with fmtr include the following:
A formatting string is a compact set of codes typically used for formatting dates and numbers. See FormattingStrings for a glossary of common formatting codes.
Named vectors map one string value to another string value.
Vectorized functions can be those created by the user or by a formatting function like those created with Base R or the scales package.
User-defined functions are those created by the fmtr
value function. See
Formatting lists are lists which contain any of the above format types.
The formatting lists allow the user to apply one of several formats to the
column. Formatting lists may also be used to apply different formats
to each item in a vector. See
additional details on formatting lists.
fapply function documentation for additional details
on applying formats.
Formats can be collected and stored as a single file, called a format
catalog. This functionality makes it easy to reuse formats in new
programs, with new data, or to share them with colleagues.
fcat function for