R/06-data_evaluate.R
data_dict_evaluate.Rd
Assesses the content and structure of a data dictionary and generates reports of the results. The report can be used to help assess data dictionary structure, presence of fields, coherence across elements, and taxonomy or data dictionary formats.
data_dict_evaluate(data_dict, taxonomy = NULL, as_data_dict_mlstr = TRUE)
A list of data frame(s) representing metadata to be evaluated.
An optional data frame identifying a variable classification schema.
Whether the input data dictionary should be coerced with specific format restrictions for compatibility with other Maelstrom Research software. TRUE by default.
A list of data frames containing assessment reports.
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
. The function truncates each cell to a maximum of
10000 characters, to be readable and compatible with Excel.
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 object may be specifically formatted to be compatible with additional Maelstrom Research software, in particular Opal environments.
{
# use madshapR_DEMO provided by the package
library(dplyr)
data_dict <- madshapR_DEMO$`data_dict_TOKYO - errors`
glimpse(data_dict_evaluate(data_dict))
}
#> - DATA DICTIONARY ASSESSMENT: data_dict --------------
#> Assess the standard adequacy of naming
#> Assess the uniqueness of variable names
#> Assess the presence of possible duplicated columns
#> Assess the presence of empty rows in the data dictionary
#> Assess the presence of empty columns in the data dictionary
#> Assess the presence of categories not in the data dictionary
#> Assess the completion of `label(:xx)` column in 'Variables'
#> Assess the `valueType` column in 'Variables'
#> Assess presence and completion of `label(:xx)` column in 'Categories'
#> Assess the logical values of missing column in Categories
#> Generate report
#>
#> - WARNING MESSAGES (if any): --------------------------------------------
#>
#> List of 2
#> $ Data dictionary summary : tibble [14 × 11] (S3: tbl_df/tbl/data.frame)
#> ..$ index : chr [1:14] "1" "2" "3" "4" ...
#> ..$ name : chr [1:14] "part_id" "gndr" "height" "weight_ms" ...
#> ..$ label:en : chr [1:14] "id of the participant" "gndr" "height" "weight_ms" ...
#> ..$ valueType : chr [1:14] "text" "boolean" "decimal" NA ...
#> ..$ Categories::table : chr [1:14] NA "Male = DEMO ; \nFemale = DEMO ; \n-77 = DEMO" "SKIP PATTERN = DEMO" "-88 = DEMO ; \n-99 = DEMO" ...
#> ..$ Categories::label:en: chr [1:14] NA "Male = Male ; \nFemale = Female ; \n-77 = Don’t want to answer" "SKIP PATTERN = SKIP PATTERN" "-88 = Don’t want to answer ; \n-99 = Do not remember" ...
#> ..$ Categories::missing : chr [1:14] NA "Male = FALSE ; \nFemale = FALSE ; \n-77 = TRUE" "SKIP PATTERN = TRUE" "-88 = TRUE ; \n-99 = TRUE" ...
#> ..$ table : chr [1:14] "DEMO" "DEMO" "DEMO" "DEMO" ...
#> ..$ description:en : chr [1:14] "id of the participant" "gender of the participant" "height of the participant" "weight of the participant - measured" ...
#> ..$ unit : chr [1:14] NA NA "cm" "kg" ...
#> ..$ copy units : chr [1:14] NA NA "cm" "kg" ...
#> $ Data dictionary assessment: tibble [18 × 6] (S3: tbl_df/tbl/data.frame)
#> ..$ sheet : chr [1:18] "Variables" "Variables" "Variables" "Variables" ...
#> ..$ col_name : chr [1:18] "copy units" "label:en" "label:en" "name" ...
#> ..$ name_var : chr [1:18] NA "dob" "opentext" "opentext" ...
#> ..$ Quality assessment comment: chr [1:18] "[INFO] - Possible duplicated columns" "[ERR] - The column `label(:xx)` must exist contain no 'NA' values" "[ERR] - The column `label(:xx)` must exist contain no 'NA' values" "[ERR] - duplicated variable name" ...
#> ..$ value : chr [1:18] "unit ; copy units" NA NA NA ...
#> ..$ suggestion : chr [1:18] NA NA NA NA ...