-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Because the package makes extensive use of data.table
, and because it uses extensively non-standard-evaluation(NSE). It may arrive that a column name is identical to some internal variable name, resulting in an error.
Example
library(didImputation)
data("did_simulated")
did_simulated$s <- rnorm(nrow(did_simulated))
didImputation(y ~ 0 | i + t,
cohort = "g",
data = did_simulated)
>> Error in s$time : $ operator is invalid for atomic vectors
Explanation
The error comes from the following line
Line 34 in 721876a
s$data[, k := get(s$time) - get(s$cohort)] |
Indeed there is name collision between the internal object
s
of the package and the column name s
.
Solution(s)
- Get rid of
data.table
NSE. - Use quasiquotation.
- Rename sensible variables with weird names to have low collision probability 🤷♂️
- Use
eval
instead ofget
In the meanwhile
Don't name a column s
...
Metadata
Metadata
Assignees
Labels
No labels