Write XML files for a disease to a directory
write_disease_dir.Rd
This function creates a directory structure for a specified disease and generates XML files for relative risks from risk factors and other diseases, as well as for disease prevalences, incidences, excess mortalities, and disability data. The directories and XML files are named and organized according to the input lists provided for each category. The function only creates files for provided arguments and leaves other files as they are.
Usage
write_disease_dir(
disease_name,
risk_factor_list,
diseases_list,
prevalences_list,
incidences_list,
excess_mortalities_list,
disability_list
)
Arguments
- disease_name
A character string representing the name of the disease. A directory will be created with this name if it does not already exist.
- risk_factor_list
A named list where each element is a list containing two components:
'data'
(the risk factor data) and'type'
(the type of risk factor). XML files will be generated for each risk factor.- diseases_list
A named list where each element is a list containing disease data under the key
'data'
. XML files will be generated for relative risks from other diseases.- prevalences_list
A named list where each element is a list containing prevalence data under the key
'data'
. XML files will be generated for each prevalence.- incidences_list
A named list where each element is a list containing incidence data under the key
'data'
. XML files will be generated for each incidence.- excess_mortalities_list
A named list where each element is a list containing three components:
'unit_type'
(the unit of the data),'parameter_type'
(the type of parameter), and'data'
(the excess mortality data). XML files will be generated for each excess mortality.- disability_list
A named list where each element is a list containing disability data under the key
'data'
. XML files will be generated for each disability dataset.
Details
The function creates a directory named after the disease and subdirectories for: containing:
Relative_Risks_From_Risk_Factor
Relative_Risks_From_Diseases
Prevalences
Incidences
Excess_Mortalities
Disabilities
For each category, the function generates XML files based on the data provided in the corresponding input list. Each XML file is saved in the appropriate subdirectory.
The risk factor 'type'
can be 'continuous'
, 'continuous4p'
, 'categorical'
,
'categorical4p'
, 'compound'
, or 'compound4p'
.
The excess mortality 'parameter_type'
can be 'Acutely Fatal'
or 'Cured Fraction'
.
Examples
if (FALSE) { # \dontrun{
# A list element corresponds to a risk factor (e.g., smoking)
risk_factors <- list("smoking" = list(data = data.frame(...), type = "categorical"))
# A list element corresponds to another disease (e.g., diabetes)
diseases <- list("diabetes" = list(data = data.frame(...)))
# A list element corresponds to a population (e.g., Netherlands)
prevalences <- list("NL" = list(data = data.frame(...)))
incidences <- list("NL" = list(data = data.frame(...)))
mortalities <- list("NL" = list(
unit_type = "Rate",
parameter_type = "Acutely Fatal",
data = data.frame(...)
))
disabilities <- list("NL" = list(data = data.frame(...)))
create_disease_dir(
"stroke", risk_factors, diseases, prevalences,
incidences, mortalities, disabilities
)
} # }