I use reformulate
to construct formulas involving a set of indicators for Reddit usernames. Unfortunately, reformulate
seems to concatenate a string out of the passed term names and parse it, which leads to some weird problems for terms that are valid usernames, but not valid identifiers:
> reformulate(c("123a", "x"), "y")
Error in str2lang(termtext) : <text>:1:4: unexpected symbol
1: 123a
^
Even worse, something like this can happen:
> reformulate(c("x", "a-b-1", "z"), "y")
y ~ x + a - b - 1 + z
How can I remedy this using some kind of "escape mechanism", and without resorting to string processing?