Skip to content

Commit

Permalink
Merge pull request #246 from larmarange/issue245
Browse files Browse the repository at this point in the history
order of variable levels with marginal prediction
  • Loading branch information
larmarange authored Apr 5, 2024
2 parents e00ffa6 + b74afda commit 04fee03
Show file tree
Hide file tree
Showing 33 changed files with 92 additions and 114 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

Expand All @@ -41,9 +41,10 @@ jobs:

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck, glmmTMB=?source, lme4=?source
extra-packages: any::rcmdcheck, glmmTMB=?source, lme4=?source, emmeans=?ignore-before-r=4.3.0, effects=?ignore-before-r=4.3.0
needs: check

- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
2 changes: 1 addition & 1 deletion .github/workflows/R-CMD-historic-R-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck, emmeans=?ignore-before-r=4.1.0, gam=?ignore-before-r=4.0.0, rstan=?ignore-before-r=4.0.0, multgee=?ignore-before-r=4.0.0, VGAM=?ignore-before-r=4.0.0, glmmTMB=?ignore
extra-packages: any::rcmdcheck, emmeans=?ignore-before-r=4.3.0, gam=?ignore-before-r=4.0.0, rstan=?ignore-before-r=4.0.0, multgee=?ignore-before-r=4.0.0, VGAM=?ignore-before-r=4.0.0, glmmTMB=?ignore, effects=?ignore-before-r=4.3.0, survey=?ignore-before-r=4.1.0
needs: check

- uses: r-lib/actions/check-r-package@v2
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,19 @@ jobs:
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::lintr, local::., glmmTMB=?ignore
extra-packages: any::lintr, local::.
needs: lint

- name: Lint
run: lintr::lint_package()
shell: Rscript {0}
env:
LINTR_ERROR_ON_LINT: true
8 changes: 5 additions & 3 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ jobs:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

Expand All @@ -30,7 +32,7 @@ jobs:

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::pkgdown, local::., glmmTMB=?ignore
extra-packages: any::pkgdown, local::.
needs: website

- name: Build site
Expand All @@ -39,7 +41,7 @@ jobs:

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4.4.1
uses: JamesIves/github-pages-deploy-action@v4.5.0
with:
clean: false
branch: gh-pages
Expand Down
38 changes: 0 additions & 38 deletions .github/workflows/render-readme.yaml

This file was deleted.

10 changes: 5 additions & 5 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,36 +15,36 @@ jobs:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::covr, glmmTMB=?ignore
extra-packages: any::covr
needs: coverage

- name: Test coverage
run: |
covr::codecov(
quiet = FALSE,
clean = FALSE,
install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package")
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
shell: Rscript {0}

- name: Show testthat output
if: always()
run: |
## --------------------------------------------------------------------
find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,4 @@ Encoding: UTF-8
Language: en-US
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
6 changes: 4 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@

**New supported models**

- Support for `mmrm::mmrm()` models (#228)
- Support for `survival::cch()` models (#242)
- support for `mmrm::mmrm()` models (#228)
- support for `survival::cch()` models (#242)

**New features**

- new `tidy_post_fun` argument in `tidy_plus_plus()` (#235)

**Fix**

- fix the order of the levels of categorical variables in the results of
`tidy_marginal_predictions()` (#245)
- fix in `supported_models`
- bug fix when using `tidy_parameters()` for mixed models (#238)
- bug fix for `survey::svyglm()` models with replicate weights (#240)
Expand Down
3 changes: 1 addition & 2 deletions R/helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@
}

# copied from broom
.exponentiate <- function (data, col = "estimate")
{
.exponentiate <- function(data, col = "estimate") {
data <- data %>%
dplyr::mutate(
dplyr::across(dplyr::all_of(col), exp)
Expand Down
1 change: 1 addition & 0 deletions R/marginal_tidiers.R
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,7 @@ tidy_marginal_predictions <- function(x, variables_list = "auto",
}

res <- do.call(marginaleffects::avg_predictions, dots) %>%
dplyr::arrange(dplyr::pick(dplyr::any_of(c(names(variables)))), "group") %>%
dplyr::mutate(variable = paste(names(variables), collapse = ":")) %>%
tidyr::unite(col = "term", sep = " * ", dplyr::all_of(names(variables))) %>%
dplyr::relocate("variable", "term")
Expand Down
6 changes: 3 additions & 3 deletions man/model_compute_terms_contributions.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions man/model_get_assign.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions man/model_get_coefficients_type.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions man/model_get_contrasts.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/model_get_model.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions man/model_get_model_frame.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions man/model_get_model_matrix.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/model_get_n.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/model_get_nlevels.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions man/model_get_offset.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 04fee03

Please sign in to comment.