kosukeimai / mediation

R package mediation
61 stars 29 forks source link

Use stricter column subsetting in `multimed()` #58

Closed christopherkenny closed 1 year ago

christopherkenny commented 1 year ago

Hi @kosukeimai. I'm using this package for a project and found that multimed() fails uninformatively in some cases. This is tied to the way that subsets are obtained from the data argument. This is the same issue as in #42.

This PR adjusts the column subsets for data and its subsets to use the stricter data[[column_name]] format over the matrix-style data[, column_name] which works for data.frame objects but not the tibble class extensions. (For context: Any data produced via readr, readxl, vroom, etc. will be tibbles. The error is a result of the stricter design choice for tibbles and is explained in Wickham's Adavanced R)

kosukeimai commented 1 year ago

Thanks @christopherkenny!