Summary:
When a data.table is provided as data, the internal function drop_redundant_dims() results in error.
Description:
When a data.table is provided to rstanarm as data, the following error is produced:
Called from: stop("j (the 2nd argument inside [...]) is a single symbol but column name '",
jsubChar, "' is not found. Perhaps you intended DT[, ..",
jsubChar, "]. This difference to data.frame is deliberate and explained in FAQ 1.1.")
This is because the method dispatch for [ is finding the method for data.table before data.frame.
Since the error message states this is intentional for data.tables, a check and/or coercion to data.frame might be warranted.
Reproducible Steps:
library(rstanarm)
library(data.table)
mt = as.data.table(mtcars)
stan_glm(mpg ~ cyl, data = mt)
RStanARM Version:
2.19.3
R Version:
3.6.3
Operating System:
Arch Linux 5.6.5-1
Summary:
When a data.table is provided as data, the internal function drop_redundant_dims() results in error.
Description:
When a data.table is provided to rstanarm as data, the following error is produced:
This is because the method dispatch for
[is finding the method for data.table before data.frame.Since the error message states this is intentional for data.tables, a check and/or coercion to data.frame might be warranted.
Reproducible Steps:
RStanARM Version:
2.19.3
R Version:
3.6.3
Operating System:
Arch Linux 5.6.5-1