Skip to content

error in summary(<vaccineff_data>) when vaccinated_status have a different value than "v" #136

Description

@avallecam
library(vaccineff)
#> Warning: package 'vaccineff' was built under R version 4.4.3

# Load example data
data("cohortdata")

# WORKS
out1 <- make_vaccineff_data(
  data_set = cohortdata,
  outcome_date_col = "death_date",
  censoring_date_col = "death_other_causes", # needs message
  vacc_date_col = "vaccine_date_2", # date of last dose
  end_cohort = as.Date("2021-12-31")
)

summary(out1)
#> Cohort start:  2021-03-11
#> Cohort end:  2021-12-31
#> The start date of the cohort was defined as the mininimum immunization date. 
#> 44 registers were removed with outcomes before the start date.
#> 
#> No matching routine invoked.
#> Summary vaccination:
#>               u     v
#> All       10933 19966
#> Matched       0     0
#> Unmatched 10933 19966
#> 
#> // tags: outcome_date_col:death_date, censoring_date_col:death_other_causes, vacc_date_col:vaccine_date_2, immunization_date_col:immunization_date, vacc_status_col:vaccine_status, t0_follow_up_col:t0_follow_up

# ERROR
out2 <- make_vaccineff_data(
  data_set = cohortdata,
  outcome_date_col = "death_date",
  censoring_date_col = "death_other_causes", # needs message
  vacc_date_col = "vaccine_date_2", # date of last dose
  end_cohort = as.Date("2021-12-31"),
  vaccinated_status = "vacc",
  unvaccinated_status = "unvacc"
)

summary(out2)
#> Error in match.names(clabs, names(xi)): names do not match previous names

Created on 2025-06-12 with reprex v2.1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions