Skip to content

Find a way to allow gratia's functions to work well with models where transformations of variables are used in formula #346

@gavinsimpson

Description

@gavinsimpson

For a variety of reasons, gratia doesn't handle models well when there are transformations of covariates applied inside s() etc in the model formula, e.g., y ~ s(log(x)).

In part, this is because Simon wipes out the references to the environment of the formula to avoid huge fitted model objects because the environment of the formula can contain copies of the data. However, not having this information makes it a bit more difficult to reconstruct the original data used to fit the model - Simon only stores the model frame, which will have a column for log(x) but not x itself.

I should be able to try to evaluate the formula / call in the calling / or global environment, and gracefully handle things if finding the data fails. I should be able to make this work reliably in practice for users, but inside testthat tests it might be a little more complicated.

Anyway; let's get this fixed once and for all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions