Assesses the content and structure of a dataset object 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.

dataset_evaluate(
  dataset,
  data_dict = NULL,
  valueType_guess = FALSE,
  as_data_dict_mlstr = TRUE,
  taxonomy = NULL,
  dataset_name = .dataset_name,
  .dataset_name = 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.

valueType_guess

Whether the output should include a more accurate valueType that could be applied to the dataset. FALSE by default.

as_data_dict_mlstr

Whether the input data dictionary should be coerced with specific format restrictions for compatibility with other Maelstrom Research software. TRUE by default.

taxonomy

An optional data frame identifying a variable classification schema.

dataset_name

A character string specifying the name of the dataset (used internally in the function dossier_evaluate()).

.dataset_name

[Deprecated]

Value

A list of data frames containing assessment reports.

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. The function truncates each cell to a maximum of 10000 characters, to be readable and compatible with Excel.

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.

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.

Examples

{

# use madshapR_DEMO provided by the package
library(dplyr)

###### Example : Any data frame can be summarized
dataset <- as_dataset(
  madshapR_DEMO$`dataset_TOKYO - errors with data`,
  col_id = 'part_id') %>% slice(0)
 
glimpse(dataset_evaluate(dataset,as_data_dict_mlstr = FALSE))

}
#> - DATA DICTIONARY ASSESSMENT: data_dict --------------
#>     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
#>     Generate report
#> 
#>     The data dictionary contains no error/warning.
#> 
#>   - WARNING MESSAGES (if any): --------------------------------------------
#> 
#> - DATASET ASSESSMENT: dataset (empty dataset) --------------------------
#>     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 duplicated participants in the dataset
#>     Assess the presence of empty rows in the data dictionary
#>     Assess the presence all NA(s) of columns in the data dictionary
#>     Assess the presence of categories not in the data dictionary
#>     Generate report
#> 
#>     The dataset contains no error/warning.
#> 
#>   - WARNING MESSAGES (if any): -------------------------------------------------
#>     
#> List of 1
#>  $ Data dictionary summary: tibble [9 × 4] (S3: tbl_df/tbl/data.frame)
#>   ..$ index : chr [1:9] "1" "2" "3" "4" ...
#>   ..$ name  : chr [1:9] "part_id" "gndr" "height" "weight_ms" ...
#>   ..$ label : chr [1:9] "part_id" "gndr" "height" "weight_ms" ...
#>   ..$ typeof: chr [1:9] "character" "character" "double" "double" ...