R/07-data_summarize.R
dossier_summarize.Rd
Assesses and summarizes the content and structure of a dossier (list of datasets) and generates reports of the results. This function can be used to evaluate data structure, presence of specific fields, coherence across elements, and data dictionary formats, and to summarize additional information about variable distributions and descriptive statistics.
dossier_summarize(
dossier,
group_by = NULL,
taxonomy = NULL,
valueType_guess = TRUE
)
List of data frame(s), each of them being datasets.
A character string identifying the column in the dataset to use as a grouping variable. Elements will be grouped by this column.
An optional data frame identifying a variable classification schema.
Whether the output should include a more accurate valueType that could be applied to the dataset. TRUE by default.
A list of data frames containing overall assessment reports and summaries grouped by dataset.
A dossier is a named list containing at least one data frame or more, each of them being datasets. The name of each data frame will be use as the reference name of the dataset.
A taxonomy is a classification schema that can be defined for variable
attributes. A taxonomy is usually extracted from an
Opal environment, and a
taxonomy object is a data frame that must contain at least the columns
taxonomy
, vocabulary
, and terms
. Additional details about Opal
taxonomies are
available online.
The valueType is a declared property of a variable that is required in certain functions to determine handling of the variables. Specifically, valueType refers to the OBiBa data type of a variable. The valueType is specified in a data dictionary in a column 'valueType' and can be associated with variables as attributes. Acceptable valueTypes include 'text', 'integer', 'decimal', 'boolean', datetime', 'date'. The full list of OBiBa valueType possibilities and their correspondence with R data types are available using valueType_list. The valueType can be used to coerce the variable to the corresponding data type.
# \donttest{
# use madshapR_examples provided by the package
library(dplyr)
###### Example : a dataset list is a dossier by definition.
dataset1 <- as_dataset(madshapR_examples$`dataset_example` %>% group_by(pick('gndr')))
dataset2 <- as_dataset(madshapR_examples$`dataset_example - error`, col_id = "part_id")
dossier <- dossier_create(list(dataset1,dataset2))
summary_dossier <- dossier_summarize(dossier)
#> - DOSSIER SUMMARY: -----------------------------------------------------
#> - DATA DICTIONARY ASSESSMENT: data_dict --------------
#> Assess the standard adequacy of naming
#> Assess the uniqueness and presence of variable names
#> Assess the presence of possible duplicated columns
#> Assess the presence of duplicated rows
#> Assess the presence of empty rows in the data dictionary
#> Assess the presence of empty column in the data dictionary
#> Assess the presence of categories not in the data dictionary
#> Assess the `valueType` column in 'Variables'
#> Assess the completion of `label` column in 'Variables'
#> Assess presence and completion of `label` column in 'Categories'
#> Assess the logical values of missing column in Categories
#> Generate report
#>
#> The data dictionary contains no errors/warnings.
#>
#> - WARNING MESSAGES (if any): --------------------------------------------
#>
#> - DATASET ASSESSMENT: dataset1 --------------------------
#> Assess the standard adequacy of naming
#> Assess the presence of variable names both in dataset and data dictionary
#> Assess the presence of possible duplicated variable in the dataset
#> Assess the presence of possible duplicated participants
#> Assess the presence of unique value columns in dataset
#> Assess the presence of empty rows in the dataset
#> Assess the presence all empty variable in the dataset
#> Assess the Categories comparison in dataset and data dictionary
#> Assess the `valueType` comparison in dataset and data dictionary
#> Generate report
#>
#> - WARNING MESSAGES (if any): -------------------------------------------------
#>
#> - DATASET SUMMARIZE: dataset1 --------------------------
#> Summarize the data type of each variable across the dataset
#> Summarize information for all variables
#> Summarize information for numerical variables
#> Summarize information for text variables
#> Summarize information for categorical variables
#> Summarize global information (Overview)
#> Generate report
#> - DATA DICTIONARY ASSESSMENT: data_dict --------------
#> Assess the standard adequacy of naming
#> Assess the uniqueness and presence of variable names
#> Assess the presence of possible duplicated columns
#> Assess the presence of duplicated rows
#> Assess the presence of empty rows in the data dictionary
#> Assess the presence of empty column in the data dictionary
#> Assess the `valueType` column in 'Variables'
#> Assess the completion of `label` column in 'Variables'
#> Generate report
#>
#> The data dictionary contains no errors/warnings.
#>
#> - WARNING MESSAGES (if any): --------------------------------------------
#>
#> - DATASET ASSESSMENT: dataset2 --------------------------
#> Assess the standard adequacy of naming
#> Assess the presence of variable names both in dataset and data dictionary
#> Assess the presence of possible duplicated variable in the dataset
#> Assess the presence of possible duplicated participants
#> Assess the presence of unique value columns in dataset
#> Assess the presence of empty rows in the dataset
#> Assess the presence all empty variable in the dataset
#> Assess the Categories comparison in dataset and data dictionary
#> Assess the `valueType` comparison in dataset and data dictionary
#> Generate report
#>
#> - WARNING MESSAGES (if any): -------------------------------------------------
#>
#> - DATASET SUMMARIZE: dataset2 --------------------------
#> Summarize the data type of each variable across the dataset
#> Summarize information for all variables
#> Summarize information for numerical variables
#> Summarize information for text variables
#> Summarize global information (Overview)
#> Generate report
glimpse(summary_dossier)
#> List of 2
#> $ dataset1:List of 6
#> ..$ Overview : tibble [14 × 5] (S3: tbl_df/tbl/data.frame)
#> ..$ Variables summary (all) : tibble [25 × 19] (S3: tbl_df/tbl/data.frame)
#> ..$ Text variable summary : tibble [9 × 19] (S3: tbl_df/tbl/data.frame)
#> ..$ Numerical variable summary : tibble [15 × 24] (S3: tbl_df/tbl/data.frame)
#> ..$ Categorical variable summary: tibble [1 × 20] (S3: tbl_df/tbl/data.frame)
#> ..$ Dataset assessment : tibble [8 × 5] (S3: tbl_df/tbl/data.frame)
#> ..- attr(*, "madshapR_group::group_by")= chr "gndr"
#> $ dataset2:List of 5
#> ..$ Overview : tibble [13 × 2] (S3: tbl_df/tbl/data.frame)
#> ..$ Variables summary (all) : tibble [9 × 18] (S3: tbl_df/tbl/data.frame)
#> ..$ Text variable summary : tibble [3 × 18] (S3: tbl_df/tbl/data.frame)
#> ..$ Numerical variable summary: tibble [5 × 23] (S3: tbl_df/tbl/data.frame)
#> ..$ Dataset assessment : tibble [13 × 5] (S3: tbl_df/tbl/data.frame)
# }