From 35526a6f84dd248c3f75a182f473646f1fc7fd06 Mon Sep 17 00:00:00 2001 From: Joseph Larmarange Date: Fri, 5 Apr 2024 08:35:31 +0200 Subject: [PATCH 1/8] ordering results of .tidy_one_marginal_prediction() --- R/marginal_tidiers.R | 1 + 1 file changed, 1 insertion(+) diff --git a/R/marginal_tidiers.R b/R/marginal_tidiers.R index 8386a074..4017d6b0 100644 --- a/R/marginal_tidiers.R +++ b/R/marginal_tidiers.R @@ -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") From af144be935ac5916389091bafcd7f95993a269fd Mon Sep 17 00:00:00 2001 From: Joseph Larmarange Date: Fri, 5 Apr 2024 10:11:00 +0200 Subject: [PATCH 2/8] update github actions --- .github/workflows/R-CMD-check.yaml | 5 ++- .github/workflows/R-CMD-historic-R-check.yaml | 2 +- .github/workflows/lint.yaml | 6 ++- .github/workflows/pkgdown.yaml | 8 ++-- .github/workflows/render-readme.yaml | 38 ------------------- .github/workflows/test-coverage.yaml | 10 ++--- 6 files changed, 18 insertions(+), 51 deletions(-) delete mode 100644 .github/workflows/render-readme.yaml diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 1e352c57..f6e6192d 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -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 @@ -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 needs: check - uses: r-lib/actions/check-r-package@v2 with: upload-snapshots: true + build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")' diff --git a/.github/workflows/R-CMD-historic-R-check.yaml b/.github/workflows/R-CMD-historic-R-check.yaml index 1d745e2e..2834bb43 100644 --- a/.github/workflows/R-CMD-historic-R-check.yaml +++ b/.github/workflows/R-CMD-historic-R-check.yaml @@ -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 needs: check - uses: r-lib/actions/check-r-package@v2 diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 38f1c4be..f60d0479 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -14,7 +14,7 @@ jobs: env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: r-lib/actions/setup-r@v2 with: @@ -22,9 +22,11 @@ jobs: - 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 diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index 63f5e334..a7276e85 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -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 @@ -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 @@ -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 diff --git a/.github/workflows/render-readme.yaml b/.github/workflows/render-readme.yaml deleted file mode 100644 index 56dd83c8..00000000 --- a/.github/workflows/render-readme.yaml +++ /dev/null @@ -1,38 +0,0 @@ -on: - push: - branches: - - main - - master - pull_request: - branches: - - main - - master - -name: Render README - -jobs: - render: - name: Render README - runs-on: macOS-latest - env: - GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - steps: - - uses: actions/checkout@v3 - - name: Setup R - uses: r-lib/actions/setup-r@v2 - with: - crayon.enabled: 'FALSE' - - uses: r-lib/actions/setup-pandoc@v2 - - name: Install rmarkdown, remotes, and the local package - run: | - install.packages("remotes", type = "binary", repos = "http://cran.rstudio.com/") - remotes::install_local(".", type = "binary", repos = "http://cran.rstudio.com/", dependencies = TRUE) - shell: Rscript {0} - - name: Render README - run: Rscript -e 'rmarkdown::render("README.Rmd")' - - name: Commit results - run: | - git config --local user.email "actions@github.com" - git config --local user.name "GitHub Actions" - git commit README.md -m 'Re-build README.Rmd' || echo "No changes to commit" - git push origin || echo "No changes to commit" diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index decdbe4a..21b8a933 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -15,7 +15,7 @@ jobs: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: r-lib/actions/setup-r@v2 with: @@ -23,7 +23,7 @@ jobs: - uses: r-lib/actions/setup-r-dependencies@v2 with: - extra-packages: any::covr, glmmTMB=?ignore + extra-packages: any::covr needs: coverage - name: Test coverage @@ -31,7 +31,7 @@ jobs: 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} @@ -39,12 +39,12 @@ jobs: 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 From 3f493c8b39a9e63c56c6e9f1c38558364ddb7afb Mon Sep 17 00:00:00 2001 From: Joseph Larmarange Date: Fri, 5 Apr 2024 10:14:23 +0200 Subject: [PATCH 3/8] document() --- DESCRIPTION | 2 +- man/model_compute_terms_contributions.Rd | 6 +++--- man/model_get_assign.Rd | 6 +++--- man/model_get_coefficients_type.Rd | 6 +++--- man/model_get_contrasts.Rd | 6 +++--- man/model_get_model.Rd | 4 ++-- man/model_get_model_frame.Rd | 6 +++--- man/model_get_model_matrix.Rd | 6 +++--- man/model_get_n.Rd | 4 ++-- man/model_get_nlevels.Rd | 4 ++-- man/model_get_offset.Rd | 6 +++--- man/model_get_pairwise_contrasts.Rd | 6 +++--- man/model_get_response.Rd | 4 ++-- man/model_get_response_variable.Rd | 4 ++-- man/model_get_terms.Rd | 6 +++--- man/model_get_weights.Rd | 6 +++--- man/model_get_xlevels.Rd | 6 +++--- man/model_identify_variables.Rd | 6 +++--- man/model_list_contrasts.Rd | 6 +++--- man/model_list_higher_order_variables.Rd | 6 +++--- man/model_list_terms_levels.Rd | 6 +++--- man/model_list_variables.Rd | 6 +++--- man/supported_models.Rd | 1 + 23 files changed, 60 insertions(+), 59 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index d8ae12dd..4c75cabb 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -87,4 +87,4 @@ Encoding: UTF-8 Language: en-US LazyData: true Roxygen: list(markdown = TRUE) -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.1 diff --git a/man/model_compute_terms_contributions.Rd b/man/model_compute_terms_contributions.Rd index 0c663d79..5a65ce96 100644 --- a/man/model_compute_terms_contributions.Rd +++ b/man/model_compute_terms_contributions.Rd @@ -70,15 +70,15 @@ Other model_helpers: \code{\link{model_get_assign}()}, \code{\link{model_get_coefficients_type}()}, \code{\link{model_get_contrasts}()}, +\code{\link{model_get_model}()}, \code{\link{model_get_model_frame}()}, \code{\link{model_get_model_matrix}()}, -\code{\link{model_get_model}()}, -\code{\link{model_get_nlevels}()}, \code{\link{model_get_n}()}, +\code{\link{model_get_nlevels}()}, \code{\link{model_get_offset}()}, \code{\link{model_get_pairwise_contrasts}()}, -\code{\link{model_get_response_variable}()}, \code{\link{model_get_response}()}, +\code{\link{model_get_response_variable}()}, \code{\link{model_get_terms}()}, \code{\link{model_get_weights}()}, \code{\link{model_get_xlevels}()}, diff --git a/man/model_get_assign.Rd b/man/model_get_assign.Rd index d9af9a51..ec746170 100644 --- a/man/model_get_assign.Rd +++ b/man/model_get_assign.Rd @@ -33,15 +33,15 @@ Other model_helpers: \code{\link{model_compute_terms_contributions}()}, \code{\link{model_get_coefficients_type}()}, \code{\link{model_get_contrasts}()}, +\code{\link{model_get_model}()}, \code{\link{model_get_model_frame}()}, \code{\link{model_get_model_matrix}()}, -\code{\link{model_get_model}()}, -\code{\link{model_get_nlevels}()}, \code{\link{model_get_n}()}, +\code{\link{model_get_nlevels}()}, \code{\link{model_get_offset}()}, \code{\link{model_get_pairwise_contrasts}()}, -\code{\link{model_get_response_variable}()}, \code{\link{model_get_response}()}, +\code{\link{model_get_response_variable}()}, \code{\link{model_get_terms}()}, \code{\link{model_get_weights}()}, \code{\link{model_get_xlevels}()}, diff --git a/man/model_get_coefficients_type.Rd b/man/model_get_coefficients_type.Rd index c624e42e..43d83271 100644 --- a/man/model_get_coefficients_type.Rd +++ b/man/model_get_coefficients_type.Rd @@ -85,15 +85,15 @@ Other model_helpers: \code{\link{model_compute_terms_contributions}()}, \code{\link{model_get_assign}()}, \code{\link{model_get_contrasts}()}, +\code{\link{model_get_model}()}, \code{\link{model_get_model_frame}()}, \code{\link{model_get_model_matrix}()}, -\code{\link{model_get_model}()}, -\code{\link{model_get_nlevels}()}, \code{\link{model_get_n}()}, +\code{\link{model_get_nlevels}()}, \code{\link{model_get_offset}()}, \code{\link{model_get_pairwise_contrasts}()}, -\code{\link{model_get_response_variable}()}, \code{\link{model_get_response}()}, +\code{\link{model_get_response_variable}()}, \code{\link{model_get_terms}()}, \code{\link{model_get_weights}()}, \code{\link{model_get_xlevels}()}, diff --git a/man/model_get_contrasts.Rd b/man/model_get_contrasts.Rd index fad6970d..c8bbac95 100644 --- a/man/model_get_contrasts.Rd +++ b/man/model_get_contrasts.Rd @@ -38,15 +38,15 @@ Other model_helpers: \code{\link{model_compute_terms_contributions}()}, \code{\link{model_get_assign}()}, \code{\link{model_get_coefficients_type}()}, +\code{\link{model_get_model}()}, \code{\link{model_get_model_frame}()}, \code{\link{model_get_model_matrix}()}, -\code{\link{model_get_model}()}, -\code{\link{model_get_nlevels}()}, \code{\link{model_get_n}()}, +\code{\link{model_get_nlevels}()}, \code{\link{model_get_offset}()}, \code{\link{model_get_pairwise_contrasts}()}, -\code{\link{model_get_response_variable}()}, \code{\link{model_get_response}()}, +\code{\link{model_get_response_variable}()}, \code{\link{model_get_terms}()}, \code{\link{model_get_weights}()}, \code{\link{model_get_xlevels}()}, diff --git a/man/model_get_model.Rd b/man/model_get_model.Rd index ec6a4d1a..e8ad0577 100644 --- a/man/model_get_model.Rd +++ b/man/model_get_model.Rd @@ -32,12 +32,12 @@ Other model_helpers: \code{\link{model_get_contrasts}()}, \code{\link{model_get_model_frame}()}, \code{\link{model_get_model_matrix}()}, -\code{\link{model_get_nlevels}()}, \code{\link{model_get_n}()}, +\code{\link{model_get_nlevels}()}, \code{\link{model_get_offset}()}, \code{\link{model_get_pairwise_contrasts}()}, -\code{\link{model_get_response_variable}()}, \code{\link{model_get_response}()}, +\code{\link{model_get_response_variable}()}, \code{\link{model_get_terms}()}, \code{\link{model_get_weights}()}, \code{\link{model_get_xlevels}()}, diff --git a/man/model_get_model_frame.Rd b/man/model_get_model_frame.Rd index 7eaef7ac..195c65b2 100644 --- a/man/model_get_model_frame.Rd +++ b/man/model_get_model_frame.Rd @@ -47,14 +47,14 @@ Other model_helpers: \code{\link{model_get_assign}()}, \code{\link{model_get_coefficients_type}()}, \code{\link{model_get_contrasts}()}, -\code{\link{model_get_model_matrix}()}, \code{\link{model_get_model}()}, -\code{\link{model_get_nlevels}()}, +\code{\link{model_get_model_matrix}()}, \code{\link{model_get_n}()}, +\code{\link{model_get_nlevels}()}, \code{\link{model_get_offset}()}, \code{\link{model_get_pairwise_contrasts}()}, -\code{\link{model_get_response_variable}()}, \code{\link{model_get_response}()}, +\code{\link{model_get_response_variable}()}, \code{\link{model_get_terms}()}, \code{\link{model_get_weights}()}, \code{\link{model_get_xlevels}()}, diff --git a/man/model_get_model_matrix.Rd b/man/model_get_model_matrix.Rd index ae29b52e..a844b833 100644 --- a/man/model_get_model_matrix.Rd +++ b/man/model_get_model_matrix.Rd @@ -76,14 +76,14 @@ Other model_helpers: \code{\link{model_get_assign}()}, \code{\link{model_get_coefficients_type}()}, \code{\link{model_get_contrasts}()}, -\code{\link{model_get_model_frame}()}, \code{\link{model_get_model}()}, -\code{\link{model_get_nlevels}()}, +\code{\link{model_get_model_frame}()}, \code{\link{model_get_n}()}, +\code{\link{model_get_nlevels}()}, \code{\link{model_get_offset}()}, \code{\link{model_get_pairwise_contrasts}()}, -\code{\link{model_get_response_variable}()}, \code{\link{model_get_response}()}, +\code{\link{model_get_response_variable}()}, \code{\link{model_get_terms}()}, \code{\link{model_get_weights}()}, \code{\link{model_get_xlevels}()}, diff --git a/man/model_get_n.Rd b/man/model_get_n.Rd index 488e7248..5848a171 100644 --- a/man/model_get_n.Rd +++ b/man/model_get_n.Rd @@ -121,14 +121,14 @@ Other model_helpers: \code{\link{model_get_assign}()}, \code{\link{model_get_coefficients_type}()}, \code{\link{model_get_contrasts}()}, +\code{\link{model_get_model}()}, \code{\link{model_get_model_frame}()}, \code{\link{model_get_model_matrix}()}, -\code{\link{model_get_model}()}, \code{\link{model_get_nlevels}()}, \code{\link{model_get_offset}()}, \code{\link{model_get_pairwise_contrasts}()}, -\code{\link{model_get_response_variable}()}, \code{\link{model_get_response}()}, +\code{\link{model_get_response_variable}()}, \code{\link{model_get_terms}()}, \code{\link{model_get_weights}()}, \code{\link{model_get_xlevels}()}, diff --git a/man/model_get_nlevels.Rd b/man/model_get_nlevels.Rd index 87a5b948..f06e5517 100644 --- a/man/model_get_nlevels.Rd +++ b/man/model_get_nlevels.Rd @@ -28,14 +28,14 @@ Other model_helpers: \code{\link{model_get_assign}()}, \code{\link{model_get_coefficients_type}()}, \code{\link{model_get_contrasts}()}, +\code{\link{model_get_model}()}, \code{\link{model_get_model_frame}()}, \code{\link{model_get_model_matrix}()}, -\code{\link{model_get_model}()}, \code{\link{model_get_n}()}, \code{\link{model_get_offset}()}, \code{\link{model_get_pairwise_contrasts}()}, -\code{\link{model_get_response_variable}()}, \code{\link{model_get_response}()}, +\code{\link{model_get_response_variable}()}, \code{\link{model_get_terms}()}, \code{\link{model_get_weights}()}, \code{\link{model_get_xlevels}()}, diff --git a/man/model_get_offset.Rd b/man/model_get_offset.Rd index a56e89d8..f0b9932e 100644 --- a/man/model_get_offset.Rd +++ b/man/model_get_offset.Rd @@ -29,14 +29,14 @@ Other model_helpers: \code{\link{model_get_assign}()}, \code{\link{model_get_coefficients_type}()}, \code{\link{model_get_contrasts}()}, +\code{\link{model_get_model}()}, \code{\link{model_get_model_frame}()}, \code{\link{model_get_model_matrix}()}, -\code{\link{model_get_model}()}, -\code{\link{model_get_nlevels}()}, \code{\link{model_get_n}()}, +\code{\link{model_get_nlevels}()}, \code{\link{model_get_pairwise_contrasts}()}, -\code{\link{model_get_response_variable}()}, \code{\link{model_get_response}()}, +\code{\link{model_get_response_variable}()}, \code{\link{model_get_terms}()}, \code{\link{model_get_weights}()}, \code{\link{model_get_xlevels}()}, diff --git a/man/model_get_pairwise_contrasts.Rd b/man/model_get_pairwise_contrasts.Rd index 21c1ed27..850adac7 100644 --- a/man/model_get_pairwise_contrasts.Rd +++ b/man/model_get_pairwise_contrasts.Rd @@ -58,14 +58,14 @@ Other model_helpers: \code{\link{model_get_assign}()}, \code{\link{model_get_coefficients_type}()}, \code{\link{model_get_contrasts}()}, +\code{\link{model_get_model}()}, \code{\link{model_get_model_frame}()}, \code{\link{model_get_model_matrix}()}, -\code{\link{model_get_model}()}, -\code{\link{model_get_nlevels}()}, \code{\link{model_get_n}()}, +\code{\link{model_get_nlevels}()}, \code{\link{model_get_offset}()}, -\code{\link{model_get_response_variable}()}, \code{\link{model_get_response}()}, +\code{\link{model_get_response_variable}()}, \code{\link{model_get_terms}()}, \code{\link{model_get_weights}()}, \code{\link{model_get_xlevels}()}, diff --git a/man/model_get_response.Rd b/man/model_get_response.Rd index ce96e5f3..040ba361 100644 --- a/man/model_get_response.Rd +++ b/man/model_get_response.Rd @@ -59,11 +59,11 @@ Other model_helpers: \code{\link{model_get_assign}()}, \code{\link{model_get_coefficients_type}()}, \code{\link{model_get_contrasts}()}, +\code{\link{model_get_model}()}, \code{\link{model_get_model_frame}()}, \code{\link{model_get_model_matrix}()}, -\code{\link{model_get_model}()}, -\code{\link{model_get_nlevels}()}, \code{\link{model_get_n}()}, +\code{\link{model_get_nlevels}()}, \code{\link{model_get_offset}()}, \code{\link{model_get_pairwise_contrasts}()}, \code{\link{model_get_response_variable}()}, diff --git a/man/model_get_response_variable.Rd b/man/model_get_response_variable.Rd index dcdd4994..cd758425 100644 --- a/man/model_get_response_variable.Rd +++ b/man/model_get_response_variable.Rd @@ -40,11 +40,11 @@ Other model_helpers: \code{\link{model_get_assign}()}, \code{\link{model_get_coefficients_type}()}, \code{\link{model_get_contrasts}()}, +\code{\link{model_get_model}()}, \code{\link{model_get_model_frame}()}, \code{\link{model_get_model_matrix}()}, -\code{\link{model_get_model}()}, -\code{\link{model_get_nlevels}()}, \code{\link{model_get_n}()}, +\code{\link{model_get_nlevels}()}, \code{\link{model_get_offset}()}, \code{\link{model_get_pairwise_contrasts}()}, \code{\link{model_get_response}()}, diff --git a/man/model_get_terms.Rd b/man/model_get_terms.Rd index 1e0c811f..aa1c5b81 100644 --- a/man/model_get_terms.Rd +++ b/man/model_get_terms.Rd @@ -47,15 +47,15 @@ Other model_helpers: \code{\link{model_get_assign}()}, \code{\link{model_get_coefficients_type}()}, \code{\link{model_get_contrasts}()}, +\code{\link{model_get_model}()}, \code{\link{model_get_model_frame}()}, \code{\link{model_get_model_matrix}()}, -\code{\link{model_get_model}()}, -\code{\link{model_get_nlevels}()}, \code{\link{model_get_n}()}, +\code{\link{model_get_nlevels}()}, \code{\link{model_get_offset}()}, \code{\link{model_get_pairwise_contrasts}()}, -\code{\link{model_get_response_variable}()}, \code{\link{model_get_response}()}, +\code{\link{model_get_response_variable}()}, \code{\link{model_get_weights}()}, \code{\link{model_get_xlevels}()}, \code{\link{model_identify_variables}()}, diff --git a/man/model_get_weights.Rd b/man/model_get_weights.Rd index 9da7a2bf..b6b9792b 100644 --- a/man/model_get_weights.Rd +++ b/man/model_get_weights.Rd @@ -66,15 +66,15 @@ Other model_helpers: \code{\link{model_get_assign}()}, \code{\link{model_get_coefficients_type}()}, \code{\link{model_get_contrasts}()}, +\code{\link{model_get_model}()}, \code{\link{model_get_model_frame}()}, \code{\link{model_get_model_matrix}()}, -\code{\link{model_get_model}()}, -\code{\link{model_get_nlevels}()}, \code{\link{model_get_n}()}, +\code{\link{model_get_nlevels}()}, \code{\link{model_get_offset}()}, \code{\link{model_get_pairwise_contrasts}()}, -\code{\link{model_get_response_variable}()}, \code{\link{model_get_response}()}, +\code{\link{model_get_response_variable}()}, \code{\link{model_get_terms}()}, \code{\link{model_get_xlevels}()}, \code{\link{model_identify_variables}()}, diff --git a/man/model_get_xlevels.Rd b/man/model_get_xlevels.Rd index 67438efa..44809bcd 100644 --- a/man/model_get_xlevels.Rd +++ b/man/model_get_xlevels.Rd @@ -46,15 +46,15 @@ Other model_helpers: \code{\link{model_get_assign}()}, \code{\link{model_get_coefficients_type}()}, \code{\link{model_get_contrasts}()}, +\code{\link{model_get_model}()}, \code{\link{model_get_model_frame}()}, \code{\link{model_get_model_matrix}()}, -\code{\link{model_get_model}()}, -\code{\link{model_get_nlevels}()}, \code{\link{model_get_n}()}, +\code{\link{model_get_nlevels}()}, \code{\link{model_get_offset}()}, \code{\link{model_get_pairwise_contrasts}()}, -\code{\link{model_get_response_variable}()}, \code{\link{model_get_response}()}, +\code{\link{model_get_response_variable}()}, \code{\link{model_get_terms}()}, \code{\link{model_get_weights}()}, \code{\link{model_identify_variables}()}, diff --git a/man/model_identify_variables.Rd b/man/model_identify_variables.Rd index c676771d..01cc8c97 100644 --- a/man/model_identify_variables.Rd +++ b/man/model_identify_variables.Rd @@ -75,15 +75,15 @@ Other model_helpers: \code{\link{model_get_assign}()}, \code{\link{model_get_coefficients_type}()}, \code{\link{model_get_contrasts}()}, +\code{\link{model_get_model}()}, \code{\link{model_get_model_frame}()}, \code{\link{model_get_model_matrix}()}, -\code{\link{model_get_model}()}, -\code{\link{model_get_nlevels}()}, \code{\link{model_get_n}()}, +\code{\link{model_get_nlevels}()}, \code{\link{model_get_offset}()}, \code{\link{model_get_pairwise_contrasts}()}, -\code{\link{model_get_response_variable}()}, \code{\link{model_get_response}()}, +\code{\link{model_get_response_variable}()}, \code{\link{model_get_terms}()}, \code{\link{model_get_weights}()}, \code{\link{model_get_xlevels}()}, diff --git a/man/model_list_contrasts.Rd b/man/model_list_contrasts.Rd index 2de7f871..c3e504a8 100644 --- a/man/model_list_contrasts.Rd +++ b/man/model_list_contrasts.Rd @@ -46,15 +46,15 @@ Other model_helpers: \code{\link{model_get_assign}()}, \code{\link{model_get_coefficients_type}()}, \code{\link{model_get_contrasts}()}, +\code{\link{model_get_model}()}, \code{\link{model_get_model_frame}()}, \code{\link{model_get_model_matrix}()}, -\code{\link{model_get_model}()}, -\code{\link{model_get_nlevels}()}, \code{\link{model_get_n}()}, +\code{\link{model_get_nlevels}()}, \code{\link{model_get_offset}()}, \code{\link{model_get_pairwise_contrasts}()}, -\code{\link{model_get_response_variable}()}, \code{\link{model_get_response}()}, +\code{\link{model_get_response_variable}()}, \code{\link{model_get_terms}()}, \code{\link{model_get_weights}()}, \code{\link{model_get_xlevels}()}, diff --git a/man/model_list_higher_order_variables.Rd b/man/model_list_higher_order_variables.Rd index e37a7fb9..dcf33a85 100644 --- a/man/model_list_higher_order_variables.Rd +++ b/man/model_list_higher_order_variables.Rd @@ -40,15 +40,15 @@ Other model_helpers: \code{\link{model_get_assign}()}, \code{\link{model_get_coefficients_type}()}, \code{\link{model_get_contrasts}()}, +\code{\link{model_get_model}()}, \code{\link{model_get_model_frame}()}, \code{\link{model_get_model_matrix}()}, -\code{\link{model_get_model}()}, -\code{\link{model_get_nlevels}()}, \code{\link{model_get_n}()}, +\code{\link{model_get_nlevels}()}, \code{\link{model_get_offset}()}, \code{\link{model_get_pairwise_contrasts}()}, -\code{\link{model_get_response_variable}()}, \code{\link{model_get_response}()}, +\code{\link{model_get_response_variable}()}, \code{\link{model_get_terms}()}, \code{\link{model_get_weights}()}, \code{\link{model_get_xlevels}()}, diff --git a/man/model_list_terms_levels.Rd b/man/model_list_terms_levels.Rd index 4c575924..6aaba138 100644 --- a/man/model_list_terms_levels.Rd +++ b/man/model_list_terms_levels.Rd @@ -84,15 +84,15 @@ Other model_helpers: \code{\link{model_get_assign}()}, \code{\link{model_get_coefficients_type}()}, \code{\link{model_get_contrasts}()}, +\code{\link{model_get_model}()}, \code{\link{model_get_model_frame}()}, \code{\link{model_get_model_matrix}()}, -\code{\link{model_get_model}()}, -\code{\link{model_get_nlevels}()}, \code{\link{model_get_n}()}, +\code{\link{model_get_nlevels}()}, \code{\link{model_get_offset}()}, \code{\link{model_get_pairwise_contrasts}()}, -\code{\link{model_get_response_variable}()}, \code{\link{model_get_response}()}, +\code{\link{model_get_response_variable}()}, \code{\link{model_get_terms}()}, \code{\link{model_get_weights}()}, \code{\link{model_get_xlevels}()}, diff --git a/man/model_list_variables.Rd b/man/model_list_variables.Rd index dc91fd16..94e37f77 100644 --- a/man/model_list_variables.Rd +++ b/man/model_list_variables.Rd @@ -104,15 +104,15 @@ Other model_helpers: \code{\link{model_get_assign}()}, \code{\link{model_get_coefficients_type}()}, \code{\link{model_get_contrasts}()}, +\code{\link{model_get_model}()}, \code{\link{model_get_model_frame}()}, \code{\link{model_get_model_matrix}()}, -\code{\link{model_get_model}()}, -\code{\link{model_get_nlevels}()}, \code{\link{model_get_n}()}, +\code{\link{model_get_nlevels}()}, \code{\link{model_get_offset}()}, \code{\link{model_get_pairwise_contrasts}()}, -\code{\link{model_get_response_variable}()}, \code{\link{model_get_response}()}, +\code{\link{model_get_response_variable}()}, \code{\link{model_get_terms}()}, \code{\link{model_get_weights}()}, \code{\link{model_get_xlevels}()}, diff --git a/man/supported_models.Rd b/man/supported_models.Rd index c6b02a49..611df714 100644 --- a/man/supported_models.Rd +++ b/man/supported_models.Rd @@ -60,6 +60,7 @@ Listing of Supported Models \code{survey::svycoxph()} \tab \cr \code{survey::svyglm()} \tab \cr \code{survey::svyolr()} \tab \cr + \code{survival::cch()} \tab `Experimental support. \cr \code{survival::clogit()} \tab \cr \code{survival::coxph()} \tab \cr \code{survival::survreg()} \tab \cr From 2b6474f60377de3e1c65362ea140dca37d29a8c2 Mon Sep 17 00:00:00 2001 From: Joseph Larmarange Date: Fri, 5 Apr 2024 10:16:32 +0200 Subject: [PATCH 4/8] NEWS update --- NEWS.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index b238f055..6b025736 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,8 +2,8 @@ **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** @@ -11,6 +11,8 @@ **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) From d81e4b59aacfbf75d33668167e78e029065d39cc Mon Sep 17 00:00:00 2001 From: Joseph Larmarange Date: Fri, 5 Apr 2024 10:17:33 +0200 Subject: [PATCH 5/8] lint package --- R/helpers.R | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/R/helpers.R b/R/helpers.R index 26c9d1eb..4b08534d 100644 --- a/R/helpers.R +++ b/R/helpers.R @@ -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) From 4db2dc28cffac461f40ca7f6299d7a9814ba9c4e Mon Sep 17 00:00:00 2001 From: Joseph Larmarange Date: Fri, 5 Apr 2024 10:22:42 +0200 Subject: [PATCH 6/8] new test --- tests/testthat/test-marginal_tidiers.R | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/testthat/test-marginal_tidiers.R b/tests/testthat/test-marginal_tidiers.R index 9a428e99..700ab8f5 100644 --- a/tests/testthat/test-marginal_tidiers.R +++ b/tests/testthat/test-marginal_tidiers.R @@ -101,6 +101,14 @@ test_that("tidy_marginal_predictions()", { skip_on_cran() skip_if_not_installed("marginaleffects") + iris <- iris %>% dplyr::arrange(dplyr::desc(Species)) + mod <- lm(Petal.Length ~ Petal.Width + Species + Sepal.Length, data = iris) + expect_error( + t <- tidy_marginal_predictions(mod), + NA + ) + expect_equal(t[t$variable == "Species", "term"], levels(iris$Species)) + mod <- lm(Petal.Length ~ Petal.Width * Species + Sepal.Length, data = iris) expect_error( t <- tidy_marginal_predictions(mod), From 4fa054dea0be0f3cb6f5e1802f19266a70ad22d6 Mon Sep 17 00:00:00 2001 From: Joseph Larmarange Date: Fri, 5 Apr 2024 10:36:45 +0200 Subject: [PATCH 7/8] ignore effects before 4.3.0 --- .github/workflows/R-CMD-check.yaml | 2 +- .github/workflows/R-CMD-historic-R-check.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index f6e6192d..67cfc3fe 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -41,7 +41,7 @@ jobs: - uses: r-lib/actions/setup-r-dependencies@v2 with: - extra-packages: any::rcmdcheck, glmmTMB=?source, lme4=?source, emmeans=?ignore-before-r=4.3.0 + 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 diff --git a/.github/workflows/R-CMD-historic-R-check.yaml b/.github/workflows/R-CMD-historic-R-check.yaml index 2834bb43..1507adc8 100644 --- a/.github/workflows/R-CMD-historic-R-check.yaml +++ b/.github/workflows/R-CMD-historic-R-check.yaml @@ -38,7 +38,7 @@ jobs: - uses: r-lib/actions/setup-r-dependencies@v2 with: - 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 + 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 needs: check - uses: r-lib/actions/check-r-package@v2 From b74afda28880431c697f3129bc4148beea54e1ed Mon Sep 17 00:00:00 2001 From: Joseph Larmarange Date: Fri, 5 Apr 2024 10:49:45 +0200 Subject: [PATCH 8/8] survey require 4.1 --- .github/workflows/R-CMD-historic-R-check.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/R-CMD-historic-R-check.yaml b/.github/workflows/R-CMD-historic-R-check.yaml index 1507adc8..ff24d974 100644 --- a/.github/workflows/R-CMD-historic-R-check.yaml +++ b/.github/workflows/R-CMD-historic-R-check.yaml @@ -38,7 +38,7 @@ jobs: - uses: r-lib/actions/setup-r-dependencies@v2 with: - 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 + 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