Type: Package
Title: Curated Datasets and Tools for Epidemiological Data Analysis
Version: 0.1.0
Maintainer: Natàlia Pallarès <npallares@igtp.cat>
Description: Curated datasets and intuitive data management functions to streamline epidemiological data workflows. It is designed to support researchers in quickly accessing clean, structured data and applying essential cleaning, summarizing, visualization, and export operations with minimal effort. Whether you're preparing a cohort for analysis or creating reports, 'DIVINE' makes the process more efficient, transparent, and reproducible.
License: GPL (≥ 3)
Encoding: UTF-8
RoxygenNote: 7.3.3
URL: https://bruigtp.github.io/DIVINE/
BugReports: https://github.com/bruigtp/DIVINE/issues
Suggests: knitr, rmarkdown
VignetteBuilder: knitr
Depends: R (≥ 4.1)
LazyData: true
Imports: dplyr, fmsb, ggplot2, gtsummary, haven, openxlsx, plotly, purrr, rlang, scales, stringr, tibble, tidyselect
NeedsCompilation: no
Packaged: 2025-11-06 13:23:26 UTC; jcarmezim
Author: Natàlia Pallarès [aut, cre], João Carmezim [aut], Pau Satorra [aut], Lucia Blanc [aut], Cristian Tebé [aut]
Repository: CRAN
Date/Publication: 2025-11-11 10:00:21 UTC

DIVINE's table on laboratory data

Description

Information on laboratory data of patients included in the DIVINE cohort. Data was collected at hospital admission.

Usage

data(analytics)

Format

A data frame with 5813 rows and 9 columns

record_id:

Identifier of each record. This information does not match the real data.

covid_wave:

A factor with levels ⁠Wave 1⁠, ⁠Wave 2⁠, ⁠Wave 3⁠, and ⁠Wave 5⁠. COVID-19 wave.

center:

A factor with levels ⁠Hospital A⁠, ⁠Hospital B⁠, ⁠Hospital C⁠, ⁠Hospital D⁠, and ⁠Hospital E⁠. Center of admission

analytics_available:

Is there an analytic available for this patient?

total_leukocytes:

Total leukocytes (mil/mm³)

hemoglobin:

Hemoglobin (g/dl)

total_lymphocytes:

Total lymphocytes (mil/mm³)

d_dimer:

D-dimer (µg/L)

c_reactive_protein:

C-reactive protein (mg/L)

References

Pallarès, N., Tebé, C., Abelenda-Alonso, G., Rombauts, A., Oriol, I., Simonetti, A. F., Rodríguez-Molinero, A., Izquierdo, E., Díaz-Brito, V., Molist, G., Gómez Melis, G., Carratalà, J., Videla, S., & MetroSud and Divine study groups (2023). Characteristics and Outcomes by Ceiling of Care of Subjects Hospitalized with COVID-19 During Four Waves of the Pandemic in a Metropolitan Area: A Multicenter Cohort Study. Infectious diseases and therapy, 12(1), 273–289. https://doi.org/10.1007/s40121-022-00705-w


DIVINE's table on information about comorbidities

Description

Information about comorbidities of patients included in the DIVINE cohort. Data was collected at hospital admission.

Usage

data(comorbidities)

Format

A data frame with 5813 rows and 37 columns

record_id:

Identifier of each record. This information does not match the real data.

covid_wave:

A factor with levels ⁠Wave 1⁠, ⁠Wave 2⁠, ⁠Wave 3⁠, and ⁠Wave 5⁠. COVID-19 wave.

center:

A factor with levels ⁠Hospital A⁠, ⁠Hospital B⁠, ⁠Hospital C⁠, ⁠Hospital D⁠, and ⁠Hospital E⁠. Center of admission

sociofunctional:

A factor with levels ⁠Lives with a spouse of similar age⁠, ⁠Lives with a spouse with some degree of dependency⁠, ⁠Lives with a non-family caregiver⁠, ⁠Lives with family. The caregiver is not their spouse⁠, ⁠Lives with family without physical dependency⁠, ⁠Lives alone and has no children or they are far away⁠, ⁠Lives alone and has nearby children⁠. Sociofunctional status

frailty:

A factor with levels No, PCC and MACA. Is the patient a chronic complex patient (PCC) or a patient with advanced chronic disease (MACA)?

barthel_score:

Punctuation in the Barthel scale used to measure performance in activities of daily living

weight:

Weight (kg)

height:

Height (cm)

body_mass_index:

Body mass index computed as \frac{\mbox{weight (kg)}}{\mbox{height (m)}^2}

dm:

A factor with levels No and Yes. Diabetes mellitus Type 2

type_dm:

A factor with levels ⁠With target organ involvement⁠ and ⁠Without complications⁠. For patients with diabetes mellitus type 2, type of disease

chronic_lung_disease:

A factor with levels No and Yes. Chronic lung disease (including COPD, asthma and obstructive sleep apnea, among others)

chronic_kidney_disease:

A factor with levels No and Yes. Severe chronic kidney disease

mild_kidney_disease:

A factor with levels No and Yes. Mild kidney disease

renal_therapy:

A factor with levels No and Yes. Is the patient currently receiving renal replacement therapy?

heart_disease:

A factor with levels No and Yes. Heart failure

coronary_disease:

A factor with levels No and Yes. Coronary heart disease

myocardial_infarction:

A factor with levels No and Yes. Has the patient ever had a heart attack?

hematologic_neo:

A factor with levels No and Yes. Haematological neoplasia

hematologic_neo_type:

A factor with levels Leukemia, Lymphoma and Myeloma. For patients with Haematological neoplasia, type of disease.

non_metastatic_neo:

A factor with levels No and Yes. Non-Metastatic Neoplasia

metastatic_neo:

A factor with levels No and Yes. Metastatic Neoplasia

stroke_tia:

A factor with levels No and Yes. Has the patient ever had a stroke or a transient ischemic attack?

peripheral_vasculopathy:

A factor with levels No and Yes. Peripheral artery disease

dementia:

A factor with levels No and Yes. Dementia

mild_liver_disease:

A factor with levels No and Yes. Mild liver disease

severe_liver_disease:

A factor with levels No and Yes. Severe liver disease

connective_tissue_disease:

A factor with levels No and Yes. Connective tissue disease

peptic_ulcer:

A factor with levels No and Yes. Peptic ulcer

hemiplegia:

A factor with levels No and Yes. Hemiplegia

hiv:

A factor with levels No and Yes. Human immunodeficiency virus

charlson_index:

Value of the Charlson Comorbidity Index. This index predicts the ten-year mortality for a patient given the information of their comorbid conditions

hypertension:

A factor with levels No and Yes. Hypertension

dyslipidemia:

A factor with levels No and Yes. Dyslipidemia

depression:

A factor with levels No and Yes. Depression

ceiling:

A factor with levels ⁠Oxygen mask⁠ (non-rebreather oxygen mask), ⁠HFNC or NIMV⁠ (high-flow nasal cannula or non-invasive mechanical ventilation) and ⁠IMV and ICU admission⁠ (invasive mechanical ventilation and acces to intensive care unit). Therapeutic ceiling of care assigned to the patient

ceiling_dico:

A factor with the dichotomization of the variable ceiling in two levels No (⁠IMV and ICU admission⁠) and Yes (⁠Oxygen mask⁠ and ⁠HFNC or NIMV⁠)

References

Pallarès, N., Tebé, C., Abelenda-Alonso, G., Rombauts, A., Oriol, I., Simonetti, A. F., Rodríguez-Molinero, A., Izquierdo, E., Díaz-Brito, V., Molist, G., Gómez Melis, G., Carratalà, J., Videla, S., & MetroSud and Divine study groups (2023). Characteristics and Outcomes by Ceiling of Care of Subjects Hospitalized with COVID-19 During Four Waves of the Pandemic in a Metropolitan Area: A Multicenter Cohort Study. Infectious diseases and therapy, 12(1), 273–289. https://doi.org/10.1007/s40121-022-00705-w


DIVINE's table on complications data

Description

Information on complications data of patients included in the DIVINE cohort. Data was collected during hospitalization.

Usage

data(complications)

Format

A data frame with 5813 rows and 9 columns

record_id:

Identifier of each record. This information does not match the real data.

covid_wave:

A factor with levels ⁠Wave 1⁠, ⁠Wave 2⁠, ⁠Wave 3⁠, and ⁠Wave 5⁠. COVID-19 wave.

center:

A factor with levels ⁠Hospital A⁠, ⁠Hospital B⁠, ⁠Hospital C⁠, ⁠Hospital D⁠, and ⁠Hospital E⁠. Center of admission

comp:

A factor with levels No and Yes. Did the patient experiment a complication while hospitalised?

kidney_failure:

A factor with levels No and Yes. Did the patient experiment kidney failure during hospital admission?

mental_status_change:

A factor with levels No and Yes. Did the patient experiment a change in its mental status during hospital admission?

nosocomial_infection:

A factor with levels No and Yes. Did the patient experiment a nosocomial infection during hospital admission?

comp_cardiac:

A factor with levels No and Yes. Did the patient experiment a cardiac complication during hospital admission? Cardiac complications included heart failure and acute coronary event.

comp_respiratory:

A factor with levels No and Yes. Did the patient experiment a respiratory complication during hospital admission? Respiratory complications included acute respiratory failure, venous thromboembolism, and pneumonia.

References

Pallarès, N., Tebé, C., Abelenda-Alonso, G., Rombauts, A., Oriol, I., Simonetti, A. F., Rodríguez-Molinero, A., Izquierdo, E., Díaz-Brito, V., Molist, G., Gómez Melis, G., Carratalà, J., Videla, S., & MetroSud and Divine study groups (2023). Characteristics and Outcomes by Ceiling of Care of Subjects Hospitalized with COVID-19 During Four Waves of the Pandemic in a Metropolitan Area: A Multicenter Cohort Study. Infectious diseases and therapy, 12(1), 273–289. https://doi.org/10.1007/s40121-022-00705-w


DIVINE's table on treatments previous to hospital admission

Description

Information on previous treatments for patients included in the DIVINE cohort. Data was collected at hospital admission.

Usage

data(concomitant_medication)

Format

A data frame with 5813 rows and 11 columns

record_id:

Identifier of each record. This information does not match the real data.

covid_wave:

A factor with levels ⁠Wave 1⁠, ⁠Wave 2⁠, ⁠Wave 3⁠, and ⁠Wave 5⁠. COVID-19 wave.

center:

A factor with levels ⁠Hospital A⁠, ⁠Hospital B⁠, ⁠Hospital C⁠, ⁠Hospital D⁠, and ⁠Hospital E⁠. Center of admission

statins_pre:

A factor with levels No and Yes. Previous treatment with statins

cortis_pre:

A factor with levels No and Yes. Previous treatment with corticosteroids

acei_pre:

A factor with levels No and Yes. Previous treatment with angiotensin-converting enzyme (ACE) inhibitors

ara2_pre:

A factor with levels No and Yes. Previous treatment with angiotensin II receptor antagonists (ARA-II)

cortis_systemic_pre:

A factor with levels No and Yes. Routine treatment with systemic corticosteroids

cortis_inhaled_pre:

A factor with levels No and Yes. Routine treatment with inhaled corticosteroids

anticoagulants_pre:

A factor with levels No and Yes. Previous treatment with anticoagulants

immunosuppre_pre:

A factor with levels No and Yes. Previous treatment with immunosuppressants

References

Pallarès, N., Tebé, C., Abelenda-Alonso, G., Rombauts, A., Oriol, I., Simonetti, A. F., Rodríguez-Molinero, A., Izquierdo, E., Díaz-Brito, V., Molist, G., Gómez Melis, G., Carratalà, J., Videla, S., & MetroSud and Divine study groups (2023). Characteristics and Outcomes by Ceiling of Care of Subjects Hospitalized with COVID-19 During Four Waves of the Pandemic in a Metropolitan Area: A Multicenter Cohort Study. Infectious diseases and therapy, 12(1), 273–289. https://doi.org/10.1007/s40121-022-00705-w


Data Overview Function

Description

This function provides a comprehensive overview of a data frame, including its dimensions, variable types, missing values count and a preview of the first few rows.

Usage

data_overview(data, preview_rows = 6)

Arguments

data

A data frame. The dataset for which you want an overview.

preview_rows

Integer. The number of rows to display in the preview. Default is 6.

Details

The function is useful for quickly inspecting the structure of a data frame and identifying any missing values or general characteristics of the data. It also allows users to customize how many rows they want to preview from the dataset.

Value

A list containing the following components:

dimensions

A vector of two elements: the number of rows and columns in the data.

variable_types

A named vector with the class of each variable (column) in the data.

missing_values

A named vector with the count of missing values (NA) for each variable.

preview

A data frame showing the first preview_rows rows of the dataset.

Examples

# Example usage with a simple data frame
data <- data.frame(
  Age = c(25, 30, NA, 22, 35),
  Height = c(175, 160, 180, NA, 165),
  Gender = c("Male", "Female", "Female", "Male", "Male")
)
overview <- data_overview(data, preview_rows = 4)
print(overview)

# Example usage with the default preview size (6 rows)
overview_default <- data_overview(data)
print(overview_default)


DIVINE's demographic table

Description

Demographic data of patients included in the DIVINE cohort. Data was collected at hospital admission.

Usage

data(demographic)

Format

A data frame with 5813 rows and 8 columns

record_id:

Identifier of each record. This information does not match the real data.

covid_wave:

A factor with levels ⁠Wave 1⁠, ⁠Wave 2⁠, ⁠Wave 3⁠, and ⁠Wave 5⁠. COVID-19 wave.

center:

A factor with levels ⁠Hospital A⁠, ⁠Hospital B⁠, ⁠Hospital C⁠, ⁠Hospital D⁠, and ⁠Hospital E⁠. Center of admission

sex:

A factor with levels Male and Female. Sex at birth

age:

Age at hospital admission

smoker:

A factor with levels Ex-smoker, No and Yes. Smoking status

alcohol:

A factor with levels No and Yes. Consumption of alcohol

residence_center:

A factor with levels No and Yes. Is the patient currently living in a long-term facility?

References

Pallarès, N., Tebé, C., Abelenda-Alonso, G., Rombauts, A., Oriol, I., Simonetti, A. F., Rodríguez-Molinero, A., Izquierdo, E., Díaz-Brito, V., Molist, G., Gómez Melis, G., Carratalà, J., Videla, S., & MetroSud and Divine study groups (2023). Characteristics and Outcomes by Ceiling of Care of Subjects Hospitalized with COVID-19 During Four Waves of the Pandemic in a Metropolitan Area: A Multicenter Cohort Study. Infectious diseases and therapy, 12(1), 273–289. https://doi.org/10.1007/s40121-022-00705-w


DIVINE's table on closure data

Description

Information on closure data of patients included in the DIVINE cohort. Data was collected at the end of hospitalization.

Usage

data(end_followup)

Format

A data frame with 5813 rows and 8 columns

record_id:

Identifier of each record. This information does not match the real data.

covid_wave:

A factor with levels ⁠Wave 1⁠, ⁠Wave 2⁠, ⁠Wave 3⁠, and ⁠Wave 5⁠. COVID-19 wave.

center:

A factor with levels ⁠Hospital A⁠, ⁠Hospital B⁠, ⁠Hospital C⁠, ⁠Hospital D⁠, and ⁠Hospital E⁠. Center of admission

clinical_stability_days:

Days from hospital admission to clinical stability

exitus_days:

Days from hospital admission to exitus

discharge_days:

Days from hospital admission to discharge

discharge:

A factor with levels No and Yes. Was the patient discharge from the hospital?

exitus:

A factor with levels No and Yes. Did the patient die during hospital admission?

References

Pallarès, N., Tebé, C., Abelenda-Alonso, G., Rombauts, A., Oriol, I., Simonetti, A. F., Rodríguez-Molinero, A., Izquierdo, E., Díaz-Brito, V., Molist, G., Gómez Melis, G., Carratalà, J., Videla, S., & MetroSud and Divine study groups (2023). Characteristics and Outcomes by Ceiling of Care of Subjects Hospitalized with COVID-19 During Four Waves of the Pandemic in a Metropolitan Area: A Multicenter Cohort Study. Infectious diseases and therapy, 12(1), 273–289. https://doi.org/10.1007/s40121-022-00705-w


Export Data to Various Formats

Description

Export a dataframe or tibble to multiple file formats. If format is NULL (default), the format will be inferred from the file extension of path. If format is provided and the extension in path does not match, the function will update the path to use the extension that corresponds to format and warn the user.

Usage

export_data(data = NULL, path = NULL, format = NULL)

Arguments

data

A dataframe or tibble to export.

path

A character string specifying the file path for the exported file.

format

Optional character string specifying the export format. Supported formats: "xlsx", "csv", "rds", "txt", "sav", "dta", "sas7bdat" (alias "xpt"). If NULL (default), the function infers the format from the path extension.

Details

Supported formats and their functionality are provided via the package dependencies:

Value

This function does not return a value. It writes the data to the specified file path and displays a success message upon completion.

Examples

## Not run: 
df <- data.frame(Name = c("Alice", "Bob"), Age = c(25, 30))

# Infer format from path extension (no format argument)
export_data(df, path = "example.xlsx")
export_data(df, path = "example.csv")

# Explicit format (function will ensure path extension matches)
export_data(df, format = "csv", path = "example")         # adds .csv
export_data(df, format = "rds", path = "example.rds")

## End(Not run)


DIVINE's table on icu data

Description

Information on ICU data of patients included in the DIVINE cohort. Data was collected during hospitalization.

Usage

data(icu)

Format

A data frame with 5813 rows and 12 columns

record_id:

Identifier of each record. This information does not match the real data.

covid_wave:

A factor with levels ⁠Wave 1⁠, ⁠Wave 2⁠, ⁠Wave 3⁠, and ⁠Wave 5⁠. COVID-19 wave.

center:

A factor with levels ⁠Hospital A⁠, ⁠Hospital B⁠, ⁠Hospital C⁠, ⁠Hospital D⁠, and ⁠Hospital E⁠. Center of admission

icu:

A factor with levels No and Yes. Was the patient admitted to the ICU?

icu_enter_days:

Days from hospital admission to ICU admission.

icu_exit_days:

Days from hospital admission to ICU discharge.

vent_mec:

A factor with levels No and Yes. Did the patient received invasive mechanical ventilation?

vent_mec_start_days:

Days from hospital admission to start of invasive mechanical ventilation.

vent_mec_end_days:

Days from hospital admission to end of invasive mechanical ventilation.

vent_mec_no_inv:

A factor with levels No and Yes. Did the patient received non-invasive mechanical ventilation?

vent_mec_no_inv_start_days:

Days from hospital admission to start of non-invasive mechanical ventilation.

vent_mec_no_inv_end_days:

Days from hospital admission to end of non-invasive mechanical ventilation.

References

Pallarès, N., Tebé, C., Abelenda-Alonso, G., Rombauts, A., Oriol, I., Simonetti, A. F., Rodríguez-Molinero, A., Izquierdo, E., Díaz-Brito, V., Molist, G., Gómez Melis, G., Carratalà, J., Videla, S., & MetroSud and Divine study groups (2023). Characteristics and Outcomes by Ceiling of Care of Subjects Hospitalized with COVID-19 During Four Waves of the Pandemic in a Metropolitan Area: A Multicenter Cohort Study. Infectious diseases and therapy, 12(1), 273–289. https://doi.org/10.1007/s40121-022-00705-w


Replace Missing Values

Description

Replace missing values (NA) in a data.frame with a specified value or method (such as mean, median, mode, constant, or custom function), applying imputation column-wise.

Usage

impute_missing(
  data,
  method = list(dplyr::where(is.numeric) ~ "mean", dplyr::where(is.character) ~ "mode",
    dplyr::where(is.factor) ~ "mode"),
  filter_by = NULL,
  drop_all_na = FALSE,
  verbose = TRUE
)

Arguments

data

A data frame. The dataset in which missing values should be imputed.

method

A list of one-sided formulas of the form ⁠<selector> ~ <value>⁠. Supported ⁠<value>⁠ options are:

  • "mean": replace with the column mean (numeric columns only).

  • "median": replace with the column median (numeric columns only).

  • "mode": replace with the most frequent value (works for numeric, character, or factor).

  • A numeric constant: replace with that constant (numeric columns).

  • A character constant: replace with that value (character/factor columns).

  • A function: a function ⁠function(col)⁠ that receives the column and returns a single value to be used as replacement for NA.

The default is list(dplyr::where(is.numeric) ~ "mean",dplyr::where(is.character) ~ "mode",dplyr::where(is.factor) ~ "mode").

filter_by

Character vector of column names. If provided, only rows that have all specified columns non-NA are kept (applied before imputation).

drop_all_na

Logical; if TRUE, rows where all columns are NA are removed before imputation.

verbose

Logical; if TRUE (default) print a concise final summary of what was imputed. Set to FALSE to suppress messages.

Details

You can remove rows that are entirely NA before imputation using drop_all_na, or filter rows based on specific variables using filter_by.

Value

A tibble with missing values replaced according to the provided specifications.

Examples

# Impute all numeric columns by their means:
impute_missing(icu)

# Impute numeric columns by median:
impute_missing(
  icu,
  method = list(where(is.numeric) ~ "median")
)

# Keep only rows where both "vent_mec_no_inv" and "vent_mec" are non-missing:
impute_missing(
  icu,
  filter_by = c("vent_mec_no_inv", "vent_mec")
)

DIVINE's table on antibiotics received during hospitalization

Description

Information on antibiotics received for patients included in the DIVINE cohort. Data was collected during hospitalization.

Usage

data(inhosp_antibiotics)

Format

A data frame with 5813 rows and 17 columns

record_id:

Identifier of each record. This information does not match the real data.

covid_wave:

A factor with levels ⁠Wave 1⁠, ⁠Wave 2⁠, ⁠Wave 3⁠, and ⁠Wave 5⁠. COVID-19 wave.

center:

A factor with levels ⁠Hospital A⁠, ⁠Hospital B⁠, ⁠Hospital C⁠, ⁠Hospital D⁠, and ⁠Hospital E⁠. Center of admission

any_antibiotic:

A factor with levels No and Yes. Did the patient receive treatment with antibiotics during hospital admission?

amoxicillin:

A factor with levels No and Yes. Treatment with amoxicillin

amoxicillin_clavulanic_acid:

A factor with levels No and Yes. Treatment with amoxicillin and clavulanic acid

azithromycin:

A factor with levels No and Yes. Treatment with azithromycin

ceftriaxone:

A factor with levels No and Yes. Treatment with ceftriaxone

ciprofloxacin:

A factor with levels No and Yes. Treatment with ciprofloxacin

cotrimoxazole:

A factor with levels No and Yes. Treatment with cotrimoxazole

levofloxacin:

A factor with levels No and Yes. Treatment with levofloxacin

linezolid:

A factor with levels No and Yes. Treatment with linezolid

meropenem:

A factor with levels No and Yes. Treatment with meropenem

piperacillin:

A factor with levels No and Yes. Treatment with piperacillin

piperacillin_tazobactam:

A factor with levels No and Yes. Treatment with piperacillin+tazobactam

teicoplanin:

A factor with levels No and Yes. Treatment with teicoplanin

other_antibiotic:

A factor with levels No and Yes. Treatment with another antibiotic

References

Pallarès, N., Tebé, C., Abelenda-Alonso, G., Rombauts, A., Oriol, I., Simonetti, A. F., Rodríguez-Molinero, A., Izquierdo, E., Díaz-Brito, V., Molist, G., Gómez Melis, G., Carratalà, J., Videla, S., & MetroSud and Divine study groups (2023). Characteristics and Outcomes by Ceiling of Care of Subjects Hospitalized with COVID-19 During Four Waves of the Pandemic in a Metropolitan Area: A Multicenter Cohort Study. Infectious diseases and therapy, 12(1), 273–289. https://doi.org/10.1007/s40121-022-00705-w


DIVINE's table on antivirals received during hospitalization

Description

Information on antivirals for patients included in the DIVINE cohort. Data was collected during hospitalization.

Usage

data(inhosp_antivirals)

Format

A data frame with 5813 rows and 10 columns

record_id:

Identifier of each record. This information does not match the real data.

covid_wave:

A factor with levels ⁠Wave 1⁠, ⁠Wave 2⁠, ⁠Wave 3⁠, and ⁠Wave 5⁠. COVID-19 wave.

center:

A factor with levels ⁠Hospital A⁠, ⁠Hospital B⁠, ⁠Hospital C⁠, ⁠Hospital D⁠, and ⁠Hospital E⁠. Center of admission

any_antiviral:

A factor with levels No and Yes. Did the patient receive treatment with antivirals during hospital admission?

hydroxychloroquine:

A factor with levels No and Yes. Treatment with hydroxychloroquine

interferon_b:

A factor with levels No and Yes. Treatment with interferon beta

kaletra_ritonavir_lopinavir:

A factor with levels No and Yes. Treatment with kaletra/ritonavir-lopinavir

remdesivir:

A factor with levels No and Yes. Treatment with remdesivir

tocilizumab:

A factor with levels No and Yes. Treatment with tocilizumab

other_antiviral:

A factor with levels No and Yes. Treatment with another antiviral

References

Pallarès, N., Tebé, C., Abelenda-Alonso, G., Rombauts, A., Oriol, I., Simonetti, A. F., Rodríguez-Molinero, A., Izquierdo, E., Díaz-Brito, V., Molist, G., Gómez Melis, G., Carratalà, J., Videla, S., & MetroSud and Divine study groups (2023). Characteristics and Outcomes by Ceiling of Care of Subjects Hospitalized with COVID-19 During Four Waves of the Pandemic in a Metropolitan Area: A Multicenter Cohort Study. Infectious diseases and therapy, 12(1), 273–289. https://doi.org/10.1007/s40121-022-00705-w


DIVINE's table on other treatments received during hospitalization.

Description

Information on other treatments for patients included in the DIVINE cohort. Data was collected during hospitalization.

Usage

data(inhosp_other_treatments)

Format

A data frame with 5813 rows and 6 columns

record_id:

Identifier of each record. This information does not match the real data.

covid_wave:

A factor with levels ⁠Wave 1⁠, ⁠Wave 2⁠, ⁠Wave 3⁠, and ⁠Wave 5⁠. COVID-19 wave.

center:

A factor with levels ⁠Hospital A⁠, ⁠Hospital B⁠, ⁠Hospital C⁠, ⁠Hospital D⁠, and ⁠Hospital E⁠. Center of admission

corticosteroids:

A factor with levels No and Yes. Treatment with corticosteroids

lmwh:

A factor with levels No and Yes. Treatment with low-molecular-weight heparin (LMWH)

oral_anticoagulants:

A factor with levels No and Yes. Treatment with oral anticoagulants

References

Pallarès, N., Tebé, C., Abelenda-Alonso, G., Rombauts, A., Oriol, I., Simonetti, A. F., Rodríguez-Molinero, A., Izquierdo, E., Díaz-Brito, V., Molist, G., Gómez Melis, G., Carratalà, J., Videla, S., & MetroSud and Divine study groups (2023). Characteristics and Outcomes by Ceiling of Care of Subjects Hospitalized with COVID-19 During Four Waves of the Pandemic in a Metropolitan Area: A Multicenter Cohort Study. Infectious diseases and therapy, 12(1), 273–289. https://doi.org/10.1007/s40121-022-00705-w


Multi-Dataset Join Utility

Description

This function performs a sequential join of multiple datasets by a specified key column.

Usage

multi_join(
  datasets,
  key = c("record_id", "covid_wave", "center"),
  join_type = "left"
)

Arguments

datasets

A list of data frames to be joined.

key

A character string representing the key column to join by. Defaults to "record_id".

join_type

A character string specifying the type of join. Options are "left", "right", "inner", or "full".

Value

A single data frame containing the joined datasets.

Examples

multi_join(
  list(analytics, comorbidities),
  join_type = "left"
)

multi_join(
  list(analytics, comorbidities),
  key = c("record_id", "covid_wave", "center"),
  join_type = "left"
)


multi_plot: Flexible Static or Interactive Plotting of Variables

Description

Generate a variety of plots—histogram, density, boxplot, barplot, violin, scatter, heatmap, or spider (radar)—either as static ggplot2 objects or interactive Plotly widgets.

Usage

multi_plot(
  data,
  x_var = NULL,
  y_var = NULL,
  plot_type = NULL,
  interactive = FALSE,
  fill_color = "steelblue",
  color = "black",
  bin_width = NULL,
  group = NULL,
  facet_var = NULL,
  z_var = NULL,
  radar_color = "steelblue",
  radar_vlabels = NULL,
  radar_vlcex = 1,
  radar_ref_lev = "Yes",
  title = NULL,
  x_lab = NULL,
  y_lab = NULL,
  legend_position = "right",
  axis_text_angle = 0,
  axis_text_size = 12,
  title_size = 14,
  theme_custom = ggplot2::theme_minimal()
)

Arguments

data

A data frame or tibble containing your data.

x_var

Character; name of the variable for x‑axis (required for all plot types except spider).

y_var

Character; name of the variable for y‑axis (required for boxplot, violin, scatter, and heatmap).

plot_type

Character; one of "histogram", "density", "boxplot", "barplot", "violin", "scatter", "heatmap", or "spider".

interactive

Logical; if TRUE, returns a Plotly interactive plot (not available for spider/radar charts). Default: FALSE.

fill_color

Character; fill color for non‑grouped geoms (default "steelblue").

color

Character; outline/line color (default "black").

bin_width

Numeric; bin width for histograms. If NULL, computed automatically.

group

Character; name of grouping variable (optional).

facet_var

Character; name of variable to facet by (optional).

z_var

Character vector; names of numeric variables for spider plot (only for "spider").

radar_color

Character or vector; border/fill color for spider chart (only for "spider").

radar_vlabels

Character or vector; names of the variables for spider chart (only for "spider").

radar_vlcex

Numeric; font size for variable labels in the spider chart (only for "spider").

radar_ref_lev

Character; reference level for factors included in the spider chart (only for "spider").

title

Character; plot title (optional).

x_lab

Character; x‑axis label (defaults to x_var).

y_lab

Character; y‑axis label (defaults to y_var or "Count").

legend_position

Character; one of "right","left","top","bottom","none" (default "right").

axis_text_angle

Numeric; rotation angle (degrees) for x‑axis tick labels (default 0).

axis_text_size

Numeric; size of axis text in pts (default 12).

title_size

Numeric; size of plot title text in pts (default 14).

theme_custom

A ggplot2 theme object (default theme_minimal()).

Details

Value

A ggplot object (if interactive = FALSE or plot_type = "spider") or a plotly object (if interactive = TRUE).

Examples


multi_plot(icu,
  x_var = "icu_enter_days",
  y_var = "vent_mec_start_days",
  plot_type = "scatter",
  color = "darkred",
  title = "ICU exit vs MV days"
)

multi_plot(
  comorbidities,
  x_var = "hypertension",
  y_var = "dyslipidemia",
  plot_type = "spider",
  z_var = c(
    "depression", "mild_kidney_disease", "ceiling_dico"
  ),
  radar_vlabels = stringr::str_to_sentence(
    c("hypertension", "dyslipidemia", "depression", "mild_kidney_disease", "ceiling_dico")
  ),
  radar_color = "steelblue",
  radar_ref_lev = "Yes"
)


DIVINE's table on severity scores at hospital admission

Description

Information on severity scores at hospital admission for patients included in the DIVINE cohort. Data was collected at hospital admission.

Usage

data(scores)

Format

A data frame with 5813 rows and 10 columns

record_id:

Identifier of each record. This information does not match the real data.

covid_wave:

A factor with levels ⁠Wave 1⁠, ⁠Wave 2⁠, ⁠Wave 3⁠, and ⁠Wave 5⁠. COVID-19 wave.

center:

A factor with levels ⁠Hospital A⁠, ⁠Hospital B⁠, ⁠Hospital C⁠, ⁠Hospital D⁠, and ⁠Hospital E⁠. Center of admission

psi:

Pneumonia severity index (PSI) at hospital admission

group_psi:

A factor with levels 1, 2, 3, and 4. PSI group

curb65:

CURB65 score at hospital admission

group_curb65:

A factor with levels 1, 2, and 3. CURB65 group

mulbsta:

MULBSTA score at hospital admission

group_mulbsta:

A factor with levels Low-risk and High-risk. MULBSTA group

rox_index:

ROX index at hospital admission

References

Pallarès, N., Tebé, C., Abelenda-Alonso, G., Rombauts, A., Oriol, I., Simonetti, A. F., Rodríguez-Molinero, A., Izquierdo, E., Díaz-Brito, V., Molist, G., Gómez Melis, G., Carratalà, J., Videla, S., & MetroSud and Divine study groups (2023). Characteristics and Outcomes by Ceiling of Care of Subjects Hospitalized with COVID-19 During Four Waves of the Pandemic in a Metropolitan Area: A Multicenter Cohort Study. Infectious diseases and therapy, 12(1), 273–289. https://doi.org/10.1007/s40121-022-00705-w


Create Summary Table

Description

This function generates a summary table using the gtsummary package. It allows customization of the reported statistics for continuous variables and categorical variables. Users can optionally include p-values for group comparisons and manage the reporting of missing values.

Usage

stats_table(
  data,
  vars = NULL,
  var_labels = NULL,
  by = NULL,
  statistic_type = "mean_sd",
  pvalue = FALSE,
  test_method = NULL,
  include_na = TRUE
)

Arguments

data

A data frame containing the dataset.

vars

A character vector of variable names to include in the summary. If NULL (default), all variables are included.

var_labels

A list of labels to replace variable names in the table.

by

A character string specifying a grouping variable. If NULL (default), no grouping is applied.

statistic_type

A character string specifying the type of statistic to report for continuous variables. Options are:

  • "mean_sd": Mean (SD) for continuous variables.

  • "median_iqr": Median (Q1; Q3) for continuous variables.

  • "both": Both Mean (SD) and Median (Q1; Q3).

pvalue

A logical value indicating whether to include p-values in the summary. Defaults to FALSE.

test_method

Optional. Only used if pvalue = TRUE. A list specifying custom statistical tests for each variable. If NULL, gtsummary will choose default tests based on variable type.

include_na

A logical value indicating whether to include rows with missing values in the output. Defaults to TRUE.

Value

A gtsummary table object.

Examples

# Mean ± SD summary
stats_table(
  vital_signs,
  vars = c("temperature", "saturation"),
  by = "supporto2",
  statistic_type = "mean_sd"
)

# Both mean ± SD and median [Q1; Q3]
stats_table(
 vital_signs,
 statistic_type = "both",
 include_na = FALSE
)

# Add p-value with default tests
stats_table(
 vital_signs,
 vars = c("temperature", "saturation"),
 by = "supporto2",
 pvalue = TRUE
)

# Add p-value and define method
stats_table(
 vital_signs,
 vars = c("temperature", "saturation"),
 by = "supporto2",
 pvalue = TRUE,
 test_method = list(temperature ~ "t.test")
)


DIVINE's symptoms table

Description

Information on COVID-19 associated symptoms of patients included in the DIVINE cohort. Data was collected at hospital admission.

Usage

data(symptoms)

Format

A data frame with 5813 rows and 24 columns

record_id:

Identifier of each record. This information does not match the real data.

covid_wave:

A factor with levels ⁠Wave 1⁠, ⁠Wave 2⁠, ⁠Wave 3⁠, and ⁠Wave 5⁠. COVID-19 wave.

center:

A factor with levels ⁠Hospital A⁠, ⁠Hospital B⁠, ⁠Hospital C⁠, ⁠Hospital D⁠, and ⁠Hospital E⁠. Center of admission

symptoms_days:

Days from symptoms onset to hospitalization

rhinorrhea:

A factor with levels No and Yes. Rhinorrhea

anosmia:

A factor with levels No and Yes. Anosmia

ageusia:

A factor with levels No and Yes. Ageusia

arthromyalgia:

A factor with levels No and Yes. Arthromyalgia

odynophagia:

A factor with levels No and Yes. Odynophagia

fever:

A factor with levels No and Yes. Fever

cough:

A factor with levels No and Yes. Cough

dyspnea:

A factor with levels No and Yes. Dyspnoea

expectoration:

A factor with levels No and Yes. Expectoration

diarrhea:

A factor with levels No and Yes. Diarrhea

vomit:

A factor with levels No and Yes. Vomiting

nausea:

A factor with levels No and Yes. Nausea

asthenia:

A factor with levels No and Yes. Asthenia

anorexia:

A factor with levels No and Yes. Anorexia

cephal:

A factor with levels No and Yes. Headache

chest_pain:

A factor with levels No and Yes. Chest pain

abdominal_pain:

A factor with levels No and Yes. Abdominal pain

confusional_syndrome:

A factor with levels No and Yes. Confusional syndrome

shock_admission:

A factor with levels No and Yes. Shock on admission

bacterial_infection:

A factor with levels No and Yes. Bacterial infection

References

Pallarès, N., Tebé, C., Abelenda-Alonso, G., Rombauts, A., Oriol, I., Simonetti, A. F., Rodríguez-Molinero, A., Izquierdo, E., Díaz-Brito, V., Molist, G., Gómez Melis, G., Carratalà, J., Videla, S., & MetroSud and Divine study groups (2023). Characteristics and Outcomes by Ceiling of Care of Subjects Hospitalized with COVID-19 During Four Waves of the Pandemic in a Metropolitan Area: A Multicenter Cohort Study. Infectious diseases and therapy, 12(1), 273–289. https://doi.org/10.1007/s40121-022-00705-w


DIVINE's vaccine table

Description

Information on COVID-19 vaccines of patients included in the DIVINE cohort. Data was collected at hospital admission and it is available for waves 3 and 5 (patients were not yet vaccinated in waves 1 and 2).

Usage

data(vaccine)

Format

A data frame with 5813 rows and 6 columns

record_id:

Identifier of each record. This information does not match the real data.

covid_wave:

A factor with levels ⁠Wave 1⁠, ⁠Wave 2⁠, ⁠Wave 3⁠, and ⁠Wave 5⁠. COVID-19 wave.

center:

A factor with levels ⁠Hospital A⁠, ⁠Hospital B⁠, ⁠Hospital C⁠, ⁠Hospital D⁠, and ⁠Hospital E⁠. Center of admission

vaccine:

A factor with levels No, Yes and ⁠Not applicable⁠ (for patients included in waves before vaccination started). Is the patient vaccinated for COVID-19?

complete_vaccine:

A factor with levels No, Partial, Complete and ⁠Not applicable⁠ (for patients included in waves before vaccination started). Is the patient partially vaccinated (one dose of two-dose vaccines), completely vaccinated (one dose for one-dose vaccines or two doses for two-dose vaccines) or not vaccinated at all?

immune_vaccine:

A factor with levels ⁠No immunity⁠, ⁠Partial immunity⁠, ⁠Total immunity⁠ and ⁠Not applicable⁠ (for patients included in waves before vaccination started). Defines the level of immunity of the patient: not vaccinated (⁠No immunity⁠), vaccinated with only one dose for two-dose vaccines (⁠Partial immunity⁠), vaccinated with two doses but less than 7 days have passed since the second dose (⁠Partial immunity⁠) or vaccinated with all the doses and more than 7 days have passed since the second dose (⁠Total immunity⁠)

References

Pallarès, N., Tebé, C., Abelenda-Alonso, G., Rombauts, A., Oriol, I., Simonetti, A. F., Rodríguez-Molinero, A., Izquierdo, E., Díaz-Brito, V., Molist, G., Gómez Melis, G., Carratalà, J., Videla, S., & MetroSud and Divine study groups (2023). Characteristics and Outcomes by Ceiling of Care of Subjects Hospitalized with COVID-19 During Four Waves of the Pandemic in a Metropolitan Area: A Multicenter Cohort Study. Infectious diseases and therapy, 12(1), 273–289. https://doi.org/10.1007/s40121-022-00705-w


DIVINE's table on vital signs

Description

Information on vital signs of patients included in the DIVINE cohort. Data was collected at hospital admission.

Usage

data(vital_signs)

Format

A data frame with 5813 rows and 13 columns

record_id:

Identifier of each record. This information does not match the real data.

covid_wave:

A factor with levels ⁠Wave 1⁠, ⁠Wave 2⁠, ⁠Wave 3⁠, and ⁠Wave 5⁠. COVID-19 wave.

center:

A factor with levels ⁠Hospital A⁠, ⁠Hospital B⁠, ⁠Hospital C⁠, ⁠Hospital D⁠, and ⁠Hospital E⁠. Center of admission

temperature:

Human body temperature (ºC)

fio2_contributed:

Fraction of inspired oxygen (%)

syst_blood_press:

Systolic blood pressure (mmHg)

diast_blood_press:

Diastolic blood pressure (mmHg)

saturation:

Oxygen saturation (%)

cardiac_freq:

Heart rate (bpm)

supporto2:

A factor with levels No and Yes. Oxygen Support

normal_radio:

A factor with levels No and Yes. Normal X-ray

pleural_effusion:

A factor with levels No and Yes. Pleural effusion

saturation_fio2:

Oxygen Saturation to FiO2 Ratio

References

Pallarès, N., Tebé, C., Abelenda-Alonso, G., Rombauts, A., Oriol, I., Simonetti, A. F., Rodríguez-Molinero, A., Izquierdo, E., Díaz-Brito, V., Molist, G., Gómez Melis, G., Carratalà, J., Videla, S., & MetroSud and Divine study groups (2023). Characteristics and Outcomes by Ceiling of Care of Subjects Hospitalized with COVID-19 During Four Waves of the Pandemic in a Metropolitan Area: A Multicenter Cohort Study. Infectious diseases and therapy, 12(1), 273–289. https://doi.org/10.1007/s40121-022-00705-w