# NOT RUN {
# Create a pointblank `informant`
# object with `create_informant()`;
# we specify a `read_fn` with the
# `~` followed by a statement that
# gets the `small_table` dataset
informant <-
create_informant(
read_fn = ~ small_table,
tbl_name = "small_table",
label = "An example."
)
# We can add *info text* to describe
# the columns in the table with multiple
# `info_columns()` calls; the *info text*
# calls are additive to existing content
# in subsections
informant <-
informant %>%
info_columns(
columns = vars(a),
info = "In the range of 1 to 10. (SIMPLE)"
) %>%
info_columns(
columns = starts_with("date"),
info = "Time-based values (e.g., `Sys.time()`)."
) %>%
info_columns(
columns = "date",
info = "The date part of `date_time`. (CALC)"
)
# Upon printing the `informant` object, we see
# the additions made to the 'Columns' section
if (interactive()) {
# The `informant` object can be written to
# a YAML file with the `yaml_write()`
# function; then, information can
# be directly edited or modified
yaml_write(
informant = informant,
filename = "informant.yml"
)
# The YAML file can then be read back
# into an informant object with the
# `yaml_read_informant()` function
informant <-
yaml_read_informant(
filename = "informant.yml"
)
}
# }
Run the code above in your browser using DataLab