R/02-harmo_process_harmonization.R
as_data_proc_elem.Rd
Checks if an object is a valid Data Processing Elements and returns it with
the appropriate Rmonize::class
attribute. This function mainly helps
validate inputs within other functions of the package but could be used
separately to ensure that an object has an appropriate structure.
as_data_proc_elem(object)
A potential Data Processing Elements object to be coerced.
A data frame with Rmonize::class
'data_proc_elem'.
The Data Processing Elements specifies the input elements and processing algorithms
to generate harmonized variables in the DataSchema formats. It is also
contains metadata used to generate documentation of the processing.
A Data Processing Elements object is a data frame with specific columns
used in data processing: dataschema_variable
, input_dataset
,
input_variables
, Mlstr_harmo::rule_category
and Mlstr_harmo::algorithm
.
To initiate processing, the first entry must be the creation of a harmonized
primary identifier variable (e.g., participant unique ID).
{
# Use Rmonize_examples to run examples.
library(dplyr)
data_proc_elem <- as_data_proc_elem(Rmonize_examples$`Data_Processing_Element_no errors`)
head(data_proc_elem)
}
#> # A tibble: 6 × 13
#> index dataschema_variable valueType input_dataset input_variables
#> <dbl> <chr> <chr> <chr> <chr>
#> 1 1 adm_unique_id NA dataset_study1 pid
#> 2 2 adm_study_id NA dataset_study1 __BLANK__
#> 3 3 sdc_age_m NA dataset_study1 maternal_age
#> 4 4 sdc_marital_m NA dataset_study1 civil_status
#> 5 5 lsb_alc_binge_m_preg NA dataset_study1 alc_c1 ; alc_c5
#> 6 6 lsb_alc_binge_m_first_tri NA dataset_study1 __BLANK__
#> # ℹ 8 more variables: `Mlstr_harmo::rule_category` <chr>,
#> # `Mlstr_harmo::algorithm` <chr>, `Mlstr_harmo::status` <chr>,
#> # `Mlstr_harmo::status_detail` <chr>, `Mlstr_harmo::comment` <chr>,
#> # input_information <chr>, input_format <chr>, internal_comment <chr>