Binds a list of data dictionaries into one data dictionary. This is a wrapper function analogous to dplyr::bind_rows().

data_dict_list_nest(data_dict_list, name_group = NULL)

Arguments

data_dict_list

A list of data frame(s) representing metadata to be transformed.

name_group

A character string of one column in the dataset that can be taken as a grouping column.

Value

A list of data frame(s) identifying a workable data dictionary structure.

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.

Examples

{

# use madshapR_DEMO provided by the package
library(dplyr)

# Create a list of data dictionaries where the column 'table' is added to 
# refer to the associated dataset. The object created is not a 
# data dictionary per say, but can be used as a structure which can be 
# shaped into a data dictionary.

data_dict_list <- list(
  data_dict_1 <- madshapR_DEMO$data_dict_TOKYO ,
  data_dict_2 <- madshapR_DEMO$data_dict_MELBOURNE)
names(data_dict_list) = c("dataset_TOKYO","dataset_MELBOURNE")

glimpse(data_dict_list_nest(data_dict_list, name_group = 'table'))

}
#> List of 2
#>  $ Variables : tibble [15 × 7] (S3: tbl_df/tbl/data.frame)
#>   ..$ table         : chr [1:15] "dataset_TOKYO" "dataset_TOKYO" "dataset_TOKYO" "dataset_TOKYO" ...
#>   ..$ index         : chr [1:15] "1" "2" "3" "4" ...
#>   ..$ name          : chr [1:15] "part_id" "gndr" "height" "weight_ms" ...
#>   ..$ label:en      : chr [1:15] "id of the participant" "gndr" "height" "weight_ms" ...
#>   ..$ description:en: chr [1:15] "id of the participant" "gender of the participant" "height of the participant" "weight of the participant - measured" ...
#>   ..$ valueType     : chr [1:15] "text" "text" "integer" "integer" ...
#>   ..$ unit          : chr [1:15] NA NA "cm" "kg" ...
#>  $ Categories: tibble [23 × 5] (S3: tbl_df/tbl/data.frame)
#>   ..$ table   : chr [1:23] "dataset_TOKYO" "dataset_TOKYO" "dataset_TOKYO" "dataset_TOKYO" ...
#>   ..$ variable: chr [1:23] "gndr" "gndr" "gndr" "weight_ms" ...
#>   ..$ name    : chr [1:23] "Male" "Female" "-77" "-88" ...
#>   ..$ label:en: chr [1:23] "Male" "Female" "Don’t want to answer" "Don’t want to answer" ...
#>   ..$ missing : chr [1:23] "FALSE" "FALSE" "TRUE" "TRUE" ...