View source: R/sprintf_data_frame.R
sprintf_data_frame | R Documentation |
Create new columns in a data.frame with sprintf results
sprintf_data_frame(data, ..., factor_out_if_factor_in = TRUE, ordered = NULL)
sprintf_data_frame_single(
data,
format,
factor_out_if_factor_in = TRUE,
ordered = NULL
)
data |
the data to use for formatting |
... |
a named list of character vectors. Names are new columns for
|
factor_out_if_factor_in |
If any of the input columns are factors, make the output column a factor in the same order as the input column factors |
ordered |
If |
format |
A named character vector where the names are column names in
|
The data frame with columns added for the names of ...
.
A character vector with one element per row of data
.
sprintf_data_frame_single()
: Generate a character vector based on sprintf
input formats
sprintf_data_frame(
data=mtcars,
cyl_mpg=c(mpg="%g miles/gallon, ", cyl="%g cylinders"),
disp_hp=c(disp="%g cu.in. displacement, ", hp="%g hp")
)
sprintf_data_frame_single(
data=mtcars,
format=c(mpg="%g miles/gallon, ", cyl="%g cylinders")
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.