I knew I had seen this before but couldn't previously remember where.
https://github.com/lme4/lme4/issues/441 ... I initially fixed with
gsub(), but (pushed by Martin Maechler to do better) I eventually
fixed it by storing the original names of the model frame (without
backticks) as an attribute fo
Thanks to Bill Dunlap for the clarification. On follow-up it turns out that this will be
an issue for many if not most of the routines in the survival package: a lot of them look
at the terms structure and make use of the dimnames of attr(terms, 'factors'), which also
keeps the unneeded backquo
I believe this has to do terms() making "term.labels" (hence the dimnames
of "factors")
with deparse(), so that the backquotes are included for non-syntactic
names. The backquotes
are not in the column names of the input data.frame (nor model frame) so
you get a mismatch
when subscripting the data
A user reported a problem with the survdiff function and the use of variables that contain
a space. Here is a simple example. The same issue occurs in survfit for the same reason.
lung2 <- lung
names(lung2)[1] <- "in st" # old name is inst
survdiff(Surv(time, status) ~ `in st`, data=lung2)
E