Skip to content

drop_rendudant_dims() issues error with data.table #431

@mespe

Description

@mespe

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions