Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs for get datagrid #979

Merged
merged 8 commits into from
Dec 13, 2024
Merged

Docs for get datagrid #979

merged 8 commits into from
Dec 13, 2024

Conversation

mattansb
Copy link
Member

Closes #978

@mattansb
Copy link
Member Author

Errors don't seem to be related to this change.

@strengejacke
Copy link
Member

Errors don't seem to be related to this change.

@vincentarelbundock this seems to be related to easystats/parameters#1048, right?

Failing test is:

══ Failed tests ════════════════════════════════════════════════════════════════
── Failure ('test-marginaleffects.R:34:3'): marginaleffects ────────────────────
Names of parameters::model_parameters(x) ('rowid', 'Parameter', 'Comparison', 'Coefficient', 'SE', 'Statistic', 'p', 'S', 'CI', 'CI_low', 'CI_high', 'Predicted', 'Species', 'Petal.Length', 'Sepal.Width') don't match 'rowid', 'Parameter', 'Coefficient', 'SE', 'Statistic', 'p', 'S', 'CI', 'CI_low', 'CI_high', 'Predicted', 'Species', 'Petal.Length', 'Sepal.Width'

So we make this conditional on marginaleffects 1.0.0?

@strengejacke
Copy link
Member

strengejacke commented Dec 13, 2024

@mattansb The check-hard error is related to this PR:

get_datagrid.emmGrid needs examples run conditionally.
I think we just need to add quietly = TRUE here, else check_if_installed() would throw an error.

@vincentarelbundock
Copy link
Contributor

Yes, I think that's right. The current main version from Github should work, in principle.

@strengejacke
Copy link
Member

hm, strange, we're importing the current main via the Remotes field.

@strengejacke
Copy link
Member

We don't expect the Comparison column:

packageVersion("marginaleffects")
#> [1] '0.24.0.6'

m <- lm(Sepal.Width ~ Species * Petal.Length, data = iris)

x <- marginaleffects::slopes(m,
  variables = "Petal.Length",
  newdata = insight::get_datagrid(m, by = "Species")
)

setdiff(
  colnames(parameters::model_parameters(x)),
  c(
    "rowid", "Parameter", "Coefficient", "SE", "Statistic", "p",
    "S", "CI", "CI_low", "CI_high", "Predicted", "Species",
    "Petal.Length", "Sepal.Width"
  )  
)
#> [1] "Comparison"

Created on 2024-12-13 with reprex v2.1.1

@strengejacke
Copy link
Member

Or is the Comparison column now expected? Looks like the test in parameters expects it. Strange, this test wasn't touched for months.

@vincentarelbundock
Copy link
Contributor

Hmm, I don't know what is going on. Maybe these kinds of tests are too strict? We don't want a break whenever a package moves columns around, unless it is a "material" change.

@strengejacke
Copy link
Member

Agree, I think its purpose is to check whether the s-value column was renamed into "S". will fix test.

@strengejacke
Copy link
Member

Ah, no, that was the test in parameters :-D

But, most important: the column Comparison, is it included in the output (and expected) or not? I remember you saying that some columns should be removed in print(), but not in the underlying data frame.

@vincentarelbundock
Copy link
Contributor

In the current CRAN, it is not include. In the future CRAN versions and on Github, it will be included.

@strengejacke
Copy link
Member

ok, I fixed the text. Shouldn't be crucial, as it's not tested on CRAN anyway.

@strengejacke strengejacke merged commit 19fc4f5 into main Dec 13, 2024
17 of 20 checks passed
@strengejacke strengejacke deleted the docs-for-get_datagrid branch December 13, 2024 17:04
@mattansb
Copy link
Member Author

Thanks for taking care of this @strengejacke 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update get_datagrid(<marginaleffects>) for structural changes in 0.24.0
3 participants