Create a manifest for exploring univariate patterns.
Source:R/create-manifest-explore-univariate.R
create_manifest_explore_univariate.RdThis function creates a meta-dataset (from the data.frame passed as a parameter)
and optionally saves the meta-dataset as a CSV. The meta-dataset specifies how the variables
should be plotted.
Usage
create_manifest_explore_univariate(
d_observed,
write_to_disk = TRUE,
path_out = getwd(),
overwrite_file = FALSE,
default_class_graph = c(numeric = "histogram_continuous", integer =
"histogram_continuous", factor = "histogram_discrete", character =
"histogram_discrete", notMatched = "histogram_generic"),
default_format = c(numeric = "scales::comma", notMatched = "scales::comma"),
bin_count_suggestion = 30L
)Arguments
- d_observed
The
data.frameto create metadata for.- write_to_disk
Indicates if the meta-dataset should be saved as a CSV.
- path_out
The file path to save the meta-dataset.
- overwrite_file
Indicates if the CSV of the meta-dataset should be overwritten if a file already exists at the location.
- default_class_graph
A
characterarray indicating which graph should be used with variables of a certain class.- default_format
A
characterarray indicating which formatting function should be displayed on the axis of the univariate graph.- bin_count_suggestion
An
integervalue of the number of roughly the number bins desired for a histogram.
Value
Returns a data.frame where each row in the metadata represents a column in d_observed.
The metadata contains the following columns
variable_nameThe variable name (ind_observed).character.remarkA blank field that allows theuser to enter notes in the CSV for later reference.classThe variable'sclass(eg, numeric, Date, factor).character.should_graphA boolean value indicating if the variable should be graphed.logical.graph_functionThe name of the function used to graph the variable.character.x_label_formatThe name of the function used to format the x-axis.character.bin_widthThe uniform width of the bins.numeric.bin_startThe location of the left boundary of the first bin.numeric.
Examples
create_manifest_explore_univariate(datasets::InsectSprays, write_to_disk=FALSE)
#> variable_name remark class should_graph graph_function x_label_format
#> 1 count numeric TRUE histogram_continuous scales::comma
#> 2 spray factor TRUE histogram_discrete scales::comma
#> bin_width bin_start rounding_digits
#> 1 1 0 1
#> 2 1 1 1
#Careful, the first column is a `ts` class.
create_manifest_explore_univariate(datasets::freeny, write_to_disk=FALSE)
#> variable_name remark class should_graph graph_function
#> 1 y ts TRUE histogram_generic
#> 2 lag.quarterly.revenue numeric TRUE histogram_continuous
#> 3 price.index numeric TRUE histogram_continuous
#> 4 income.level numeric TRUE histogram_continuous
#> 5 market.potential numeric TRUE histogram_continuous
#> x_label_format bin_width bin_start rounding_digits
#> 1 scales::comma 1.000 1.000 1
#> 2 scales::comma 0.050 8.750 6
#> 3 scales::comma 0.020 4.260 6
#> 4 scales::comma 0.010 5.820 6
#> 5 scales::comma 0.005 12.965 6