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, is_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.
{
library(dplyr)
# use madshapR_examples provided by the package
data_dict <- madshapR_examples$`data_dictionary_example - errors`
eval_data_dict <- data_dict_evaluate(data_dict,is_data_dict_mlstr = TRUE)
glimpse(eval_data_dict)
}
#> - 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:en` column in 'Variables'
#> Assess presence and completion of `label:en` 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 [12 × 6] (S3: tbl_df/tbl/data.frame)
#> ..$ Index : chr [1:12] "1" "2" "3" "4" ...
#> ..$ Variable name : chr [1:12] "part_id" "gndr" "height" "weight_ms" ...
#> ..$ Variable label : chr [1:12] "id of the participant" "gndr" "height" "weight_ms" ...
#> ..$ Data dictionary valueType : chr [1:12] "text" "boolean" "decimal" NA ...
#> ..$ Categories in data dictionary: chr [1:12] NA "[1] Male\n[2] Female\n[-77] Don’t want to answer" "[SKIP PATTERN]" "[-88] Don’t want to answer\n[-99] Do not remember" ...
#> ..$ Non-valid categories : chr [1:12] NA NA NA NA ...
#> $ Data dictionary assessment: tibble [25 × 7] (S3: tbl_df/tbl/data.frame)
#> ..$ Index : chr [1:25] "2" "3" "4" "5" ...
#> ..$ Variable name : chr [1:25] "gndr" "height" "weight_ms" "weight dc" ...
#> ..$ Column name : chr [1:25] "valueType" "valueType" "valueType" "name" ...
#> ..$ Data dictionary assessment: chr [1:25] "[ERROR] - valueType is not compatible with variable categories." "[ERROR] - valueType is not compatible with variable categories." "[INFO] - valueType is missing (see ??valueType_list for complete list)." "[INFO] - Variable names contain special characters, contain spaces, or begin with a number." ...
#> ..$ Sheet : chr [1:25] "Variables" "Variables" "Variables" "Variables" ...
#> ..$ Value : chr [1:25] "boolean" "decimal" "(empty)" NA ...
#> ..$ Suggested valueType : chr [1:25] "integer" "text" "text" NA ...