Analyses the content of a dataset and its data dictionary (if any), identifies variable(s) data type and values accordingly and preprocess the variables. The elements of the data frame generated are evaluation of valid/non valid/missing values (based on the data dictionary information if provided). This function can be used to personalize report parameters and is internally used in the function dataset_summarize().

Generates a data frame that evaluates and aggregates all columns in a dataset with (if any) its data dictionary. The data dictionary (if present) separates observations between open values, missing values, categorical values , and categorical missing values (which corresponds to the 'missing' column in the 'Categories' sheet). This internal function is mainly used inside summary functions.

dataset_preprocess(dataset, data_dict = NULL)

Arguments

dataset

A dataset object.

data_dict

A list of data frame(s) representing metadata of the input dataset. Automatically generated if not provided.

Value

A data frame providing summary elements of a dataset, including its values and data dictionary elements.

Details

A data dictionary contains the list of variables in a dataset and metadata about the variables and can be associated with a dataset. A data dictionary object is a list of data frame(s) named 'Variables' (required) and 'Categories' (if any). To be usable in any function, the data frame 'Variables' must contain at least the name column, with all unique and non-missing entries, and the data frame 'Categories' must contain at least the variable and name columns, with unique combination of variable and name.

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.

Examples

{
 
###### Example : Any data frame can be a dataset by definition.
head(dataset_preprocess(dataset = iris))

}
#> # A tibble: 6 × 10
#>   index name        `Categorical variable` valid_class value_var_occur value_var
#>   <int> <chr>       <chr>                  <chr>                 <dbl> <chr>    
#> 1     1 Sepal.Leng… no                     3_Valid ot…               1 5.1      
#> 2     1 Sepal.Leng… no                     3_Valid ot…               1 4.9      
#> 3     1 Sepal.Leng… no                     3_Valid ot…               1 4.7      
#> 4     1 Sepal.Leng… no                     3_Valid ot…               1 4.6      
#> 5     1 Sepal.Leng… no                     3_Valid ot…               1 5        
#> 6     1 Sepal.Leng… no                     3_Valid ot…               1 5.4      
#> # ℹ 4 more variables: index_value <int>, cat_index <int>, cat_label <chr>,
#> #   index_in_dataset <int>