calc_rwPFS | R Documentation |
Calculates the real-world PFS (rwPFS) endpoint given information on follow-up period, progression-, and death dates.
calc_rwPFS(
.df,
.start_date = NULL,
.visit_gap_start_date = NULL,
.last_progression_abstraction_date = NULL,
.progression_date = NULL,
.last_activity_date = NULL,
.death_date = NULL,
.death_window_days = NULL,
.max_follow_up_days = Inf,
.label = ""
)
.df |
a data frame |
.start_date |
character. The name of a date column in .df that represents the baseline date |
.visit_gap_start_date |
character. The name of a date column in .df that represents the date of the last visit before a large (usually >90d) visit gap occurring after start_date (if any). Progression follow-up will be censored at this date (latest). Dates should be NA if there's no visit gap. |
.last_progression_abstraction_date |
character. The name of a date column in .df that represents the date up which real-world progression was abstracted in the database. Progression follow-up will be censored at this date (latest). |
.progression_date |
character. The name of a date column in .df that represents the date of first progression after start date (if any). Dates should be NA if there's no progression. |
.last_activity_date |
character. The name of a date column in .df that represents the date of last structural activity in the database. Progression follow-up will be censored at this date (latest). |
.death_date |
character. The name of a date column in .df that represents the date of death. Dates should be NA if there's no recorded death. |
.death_window_days |
integer. How many days after end of progression follow-up should death events be included? This is necessary because patients often drop out of the database shortly before death, and (only) death events correlated with the end of follow-up should be captured. Common values are 30-60 days, but this may depend on various factors. See vignette for how to decide on the length of this time window. |
.max_follow_up_days |
integer. Maximum number of days after which patients will be censored. |
.label |
character. Label to keep track of multiple rwPFS endpoints in one dataset. |
Returns a data frame with the following new data columns added:
New Columns:
The end date of progression follow-up. This is the earliest non-missing date of .visit_gap_start_date
,
.last_progression_abstraction_date
, and .last_activity_date
The type of rwPFS event: "Death", "Progression", "Censored", or "Missing" (if rwPFS could not be calculated)
The rwPFS event- or censoring date.
The time from .start_date
to rwpfs<label>_date
in days.
Whether a rwPFS event was recorded (1) or the observation was censored (0)
The time from .start_date
to rwpfs<label>_date
in months.
If rwPFS could not be calculated, the rwpfs<label>_event_type
will be set to "Missing", and all other columns will contain missing values.
This can be due to one of the following reasons: missing .last_progression_abstraction_date
<= .start_date
, missing .last_activity_date
or <= .start_date
, .last_progression_abstraction_date
<= .start_date
,
or .death_date
<= .start_date
(this can happen when death dates are rounded for anonymization purposes).
## Not run:
library(dplyr)
library(RwPFS)
#Starting point: the simprog simulated dataset (included in RwPFS)
#Add rwPFS:
df <- simprog %>%
calc_rwPFS(
.start_date = "baseline_date", #baseline date for measuring time-to-event
.visit_gap_start_date = "visit_gap_start_date", #the start date of any gap in visits >90 days
.last_progression_abstraction_date = "last_progression_abstraction_date",
.progression_date = "progression_date_all_events",#the date of progression (none: NA)
.last_activity_date = "last_activity_date", #the date of last activity in the database
.death_date = "death_date", #the date of death
.death_window_days = 30, #include death events <30d after progression EOF
.max_follow_up_days = Inf, #censor patients after a maximum time.
.label = "_all_events" #Label for this rwPFS endpoint (for comparisons)
)
#View the result:
df %>%
select(contains("rwPFS")) %>%
glimpse()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.