R/03-dataset_functions.R
dataset_zap_data_dict.Rd
Removes any attributes attached to a data frame. Any value in columns will be preserved. Any 'Date' (typeof) column will be recast as character to preserve information.
dataset_zap_data_dict(dataset, zap_factor = FALSE)
A dataset object.
Whether the factor column should be coerced with its corresponding valueType. FALSE by default.
A data frame identifying a dataset.
A dataset is a data table containing variables. A dataset object is a data frame and can be associated with a data dictionary. If no data dictionary is provided with a dataset, a minimum workable data dictionary will be generated as needed within relevant functions. Identifier variable(s) for indexing can be specified by the user. The id values must be non-missing and will be used in functions that require it. If no identifier variable is specified, indexing is handled automatically by the function.
{
# use madshapR_examples provided by the package
dataset <- madshapR_examples$`dataset_example`
data_dict <- as_data_dict_mlstr(madshapR_examples$`data_dictionary_example`)
dataset <- data_dict_apply(dataset,data_dict)
unlabbeled_dataset <- dataset_zap_data_dict(dataset)
head(unlabbeled_dataset)
}
#> # A tibble: 6 × 9
#> part_id gndr height weight_ms weight_dc dob prg_ever empty opentext
#> <chr> <fct> <int> <fct> <dbl> <date> <fct> <int> <chr>
#> 1 ID001 1 191 63 NA 1990-03-22 -7 NA All childr…
#> 2 ID002 2 176 NA 65 2001-08-15 0 NA grow up, a…
#> 3 ID003 2 154 NA 121 1996-12-17 2 NA years old …
#> 4 ID004 2 167 -88 NA 1990-06-13 1 NA flower and…
#> 5 ID005 2 185 NA 45 1996-12-17 8 NA rather del…
#> 6 ID006 -77 171 57 NA 1981-03-31 -7 NA cried, Oh,…