View source: R/generate-check-data.R
| generate_check_data | R Documentation |
check_data() CodeGenerates the code for a check_data() call from an example data frame so
the column specification does not have to be written out by hand.
generate_check_data(x, data_name = NULL)
x |
A data frame to generate the |
data_name |
A string of the name to use for the data frame in the
generated code or NULL to use the name of |
For each column the generated values entry captures
the column's class,
whether it permits missing values,
the range (minimum and maximum) of numeric, Date and POSIXct columns, and
the levels of factors.
The result is a starting point that is expected to be edited, for example to widen a range or relax a set of factor levels. The code is printed to the console (so it can be copied) and returned invisibly as a string.
A string of the generated code, invisibly.
check_data()
data <- data.frame(
count = c(1L, 3L, NA),
letter = c("a", "b", "c"),
height = c(1.5, 2.5, 3.5)
)
generate_check_data(data)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.