fapply2 function applies formatting to two different vectors, and
combines them into a single vector. This function is useful in cases
where your data is in two different variables, and you would like them
displayed as a single column for reporting purposes. For example, if you
wish to create one column to display mean and standard deviation.
fapply2( x1, x2, format1 = NULL, format2 = NULL, sep = " ", width = NULL, justify = NULL )
A vector, factor, or list to apply the format1 to.
A second vector, factor, or list to which format2 will be applied.
A format to be applied to the first input.
A format to be applied to the second input.
A separator to use between the two formatted values. Default is a single blank space (" ").
The desired character width of the formatted vector. Default value is NULL, meaning the vector will be variable width.
Whether to justify the return vector. Valid values are 'left', 'right', 'center', 'centre', or 'none'.
A vector of formatted values.
fapply2 function works nearly the same as
The difference is it has parameters for two vectors and formats instead of one.
The output of the function
is a single vector. The function essentially calls
on each vector and pastes them together afterwards.
There is an additional
sep parameter so you can
define a separator between the two formatted values.
will apply to the single vector result. The function will also
pick up format attributes on the supplied vectors.
Parameters may also be passed as attributes on the vector. See
fattr function for additional information on setting
fapply to format a single input,
fcat to create a format catalog,
value to define a format,
fattr to easily set the formatting attributes of a vector,
flist to define a formatting list. Also see
fdata to apply formats to an entire data frame, and
FormattingStrings for how to define a formatting string.