# Minimal example WITHOUT a cDAPSA column (it will be computed as SJC+TJC+Pain+PG)
df1 <- data.frame(
id = 1:3,
pain = c(4, 6, 8),
pg = c(3, 7, 9),
sjc = c(1, 3, 5),
tjc = c(0, 2, 4)
)
calculate_PJC(
df1,
cohort_id = "id",
cDAPSA = NULL,
Pain = "pain",
Patient_Global = "pg",
SJC = "sjc",
TJC = "tjc",
oob_action = "na"
)
# Example WITH a consistent cDAPSA column (verified against the sum)
df2 <- transform(df1, cdapsa = pain + pg + sjc + tjc)
calculate_PJC(
df2,
cohort_id = "id",
cDAPSA = "cdapsa",
Pain = "pain",
Patient_Global = "pg",
SJC = "sjc",
TJC = "tjc"
)
Run the code above in your browser using DataLab