Skip to content

Fix vacc_date_col to Name of the column that contain the date of the last vaccine dose. #135

@avallecam

Description

@avallecam

From the documentation, I understand that the argument could be a character vector of two date columns, like c("vaccine_date_1", "vaccine_date_2")

#' @param vacc_date_col Name of the column(s) that contain the vaccine dates.

However, on vignette https://epiverse-trace.github.io/vaccineff/articles/cohort_design.html#estimating-ve-without-iterative-matching-process we have:

To begin the analysis, the first step is to transform the original data into a vaccineff data by make_vaccineff_data function and declare the names of variables containing relevant information such as (...) date of last dose vacc_date_col (...

reprex:

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

# Load example data
data("cohortdata")

# PASS: only last date
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")
)

# ERROR: vector of dates
out2 <- make_vaccineff_data(
  data_set = cohortdata,
  outcome_date_col = "death_date",
  censoring_date_col = "death_other_causes", # needs message
  vacc_date_col = c("vaccine_date_1", "vaccine_date_2"),
  end_cohort = as.Date("2021-12-31")
)
#> Error in base::tryCatch(base::withCallingHandlers({: 1 assertions failed:
#>  * Variable 'tag': Must be element of set
#>  * {'id','sex','age','death_date','death_other_causes','vaccine_date_1','vaccine_date_2','vaccine_1','vaccine_2','immunization_date','immunizing_vaccine','vaccine_status'},
#>  * but is not atomic scalar.

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