| schema | R Documentation |
schema object.Generate a schema object.
schema(
conf_data,
start_data,
col_schema = NULL,
enforce = TRUE,
coerce_to_factors = FALSE,
coerce_to_doubles = FALSE,
na_factor_to_level = TRUE,
na_numeric_to_ind = TRUE
)
conf_data |
A data frame to be synthesized. |
start_data |
A data frame with starting variables. |
col_schema |
An optional named list of columns in the confidential data
with their properties, including data type and factor levels. If NULL or only
partially specified, |
enforce |
Boolean that if true, will preprocess both |
coerce_to_factors |
Boolean that if true, coerces categorical data types
( |
coerce_to_doubles |
Boolean that if true, coerces columns specified as |
na_factor_to_level |
Boolean that if true, applies |
na_numeric_to_ind |
Boolean that if true, applies |
A schema object.
conf_data <- data.frame(
var1 = c("1", "1", "2"),
var2 = c(1L, 2L, 3L),
var3 = c(1.1, 2.2, 3.3)
)
start_data <- dplyr::select(conf_data, var1)
# default inferred schema
schema(
conf_data = conf_data,
start_data = start_data
)
# overwriting factor levels
schema(
conf_data = conf_data,
start_data = start_data,
col_schema = list(
"var1" = list(
"dtype" = "fct",
"levels" = c("1", "2", "3")
)
),
coerce_to_factors = TRUE
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.