You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In L384 we see that the pivoting of the survfit result on the strata levels matches all "=" delimiters, but sometimes, we include "=" itself in the strata levels, e.g. comparing age "<60" vs. ">=60". The reprex below demonstrates the error thrown.
library(survival)
library(dplyr)
#> #> Attaching package: 'dplyr'#> The following objects are masked from 'package:stats':#> #> filter, lag#> The following objects are masked from 'package:base':#> #> intersect, setdiff, setequal, union
library(cardx)
lung2<-lung %>%
mutate(age_bin=factor(ifelse(age<60, "<60", ">=60")))
survfit(Surv(time, status) ~age_bin, data=lung2) %>%
ard_survival_survfit(times=100)
#> Error in `tidyr::separate_wider_delim()`:#> ! Expected 2 pieces in each element of `strata`.#> ! 5 values were too long.#> ℹ Use `too_many = "debug"` to diagnose the problem.#> ℹ Use `too_many = "drop"/"merge"` to silence this message.
Thanks @dchiu911 for the report! I can't recall the exact details, but I thought we were using stats::terms() to parse the variable names. @edelarua when you have a moment, can you investigate?
What happened?
In L384 we see that the pivoting of the survfit result on the strata levels matches all "=" delimiters, but sometimes, we include "=" itself in the strata levels, e.g. comparing
age
"<60" vs. ">=60". The reprex below demonstrates the error thrown.Created on 2025-01-06 with reprex v2.1.1
A more conservative approach to splitting the stratification variable name and its levels could be to separate by the first "=" sign:
There's probably better ways to capture the regex.
The text was updated successfully, but these errors were encountered: