fmtr | R Documentation |
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.
The fdata
function returns a new data frame with the formats applied to each column
as specified.
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
user-defined format.
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:
Formatting strings
Named vectors
Vectorized functions
User-defined formats
Formatting lists
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 value
for
additional details.
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 flist
for
additional details on formatting lists.
See the 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.
See the fcat
function for
additional information.
Useful links:
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.