Print a template field_types() specification to console
Source:R/field_types.R
template_field_types.Rd
Helper function to generate template code for a field_types()
specification,
based on the supplied data frame. All fields (columns) in the specification
will be defined using the default_field_type
, and the console output can be
copied and edited before being used as input to daiquiri_report()
or prepare_data()
.
Usage
template_field_types(df, default_field_type = ft_ignore())
Arguments
- df
data frame including the column names for the template specification
- default_field_type
field_type
to be used for each column. Default =ft_ignore()
. Seefield_types_available()
Examples
df <- data.frame(
col1 = rep("2022-01-01", 5),
col2 = rep(1, 5),
col3 = 1:5,
col4 = rnorm(5)
)
template_field_types(df, default_field_type = ft_numeric())
#> field_types(
#> "col1" = ft_numeric(),
#> "col2" = ft_numeric(),
#> "col3" = ft_numeric(),
#> "col4" = ft_numeric()
#> )