From 5dbb37b19cde4121bc7ef4eb6669ff389d258a98 Mon Sep 17 00:00:00 2001 From: Graeme Blair Date: Mon, 2 Dec 2024 16:02:25 -0800 Subject: [PATCH 01/14] ed --- CRAN-SUBMISSION | 3 --- rdss.Rproj | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) delete mode 100644 CRAN-SUBMISSION diff --git a/CRAN-SUBMISSION b/CRAN-SUBMISSION deleted file mode 100644 index 4f63fc2..0000000 --- a/CRAN-SUBMISSION +++ /dev/null @@ -1,3 +0,0 @@ -Version: 1.0.12 -Date: 2024-10-07 18:00:19 UTC -SHA: 1802077891d79bc7df8b64a7d51448970b34ea27 diff --git a/rdss.Rproj b/rdss.Rproj index ef6fa31..239a455 100644 --- a/rdss.Rproj +++ b/rdss.Rproj @@ -2,7 +2,7 @@ Version: 1.0 RestoreWorkspace: No SaveWorkspace: No -AlwaysSaveHistory: Default +AlwaysSaveHistory: No EnableCodeIndexing: Yes UseSpacesForTab: Yes From 652d1bddbb6c1c6ce69d92460de7d89e3a6b2aed Mon Sep 17 00:00:00 2001 From: Graeme Blair Date: Tue, 10 Dec 2024 19:13:09 -0800 Subject: [PATCH 02/14] redo gh action --- .github/.gitignore | 1 + .github/workflows/R-CMD-check.yaml | 51 +++++++++++++++ .github/workflows/r.yml | 101 ----------------------------- 3 files changed, 52 insertions(+), 101 deletions(-) create mode 100644 .github/.gitignore create mode 100644 .github/workflows/R-CMD-check.yaml delete mode 100644 .github/workflows/r.yml diff --git a/.github/.gitignore b/.github/.gitignore new file mode 100644 index 0000000..2d19fc7 --- /dev/null +++ b/.github/.gitignore @@ -0,0 +1 @@ +*.html diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml new file mode 100644 index 0000000..562fe0f --- /dev/null +++ b/.github/workflows/R-CMD-check.yaml @@ -0,0 +1,51 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +on: + push: + branches: [main, master] + pull_request: + +name: R-CMD-check.yaml + +permissions: read-all + +jobs: + R-CMD-check: + runs-on: ${{ matrix.config.os }} + + name: ${{ matrix.config.os }} (${{ matrix.config.r }}) + + strategy: + fail-fast: false + matrix: + config: + - {os: macos-latest, r: 'release'} + - {os: windows-latest, r: 'release'} + - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} + - {os: ubuntu-latest, r: 'release'} + - {os: ubuntu-latest, r: 'oldrel-1'} + + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + R_KEEP_PKG_SOURCE: yes + + steps: + - uses: actions/checkout@v4 + + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-r@v2 + with: + r-version: ${{ matrix.config.r }} + http-user-agent: ${{ matrix.config.http-user-agent }} + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::rcmdcheck + 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.yml b/.github/workflows/r.yml deleted file mode 100644 index 2f19a0d..0000000 --- a/.github/workflows/r.yml +++ /dev/null @@ -1,101 +0,0 @@ -on: - push: - branches: - - main - pull_request: - branches: - - main - -name: R-CMD-check - -jobs: - R-CMD-check: - runs-on: ${{ matrix.config.os }} - - name: ${{ matrix.config.os }} (${{ matrix.config.r }}) - - strategy: - fail-fast: false - matrix: - config: - - {os: macOS-latest, r: 'devel'} - - {os: macOS-latest, r: 'release'} - - {os: macOS-latest, r: 'oldrel'} - - {os: windows-latest, r: 'devel'} - - {os: windows-latest, r: 'release'} - - {os: windows-latest, r: 'oldrel'} - - {os: ubuntu-latest, r: 'devel'} - - {os: ubuntu-latest, r: 'release'} - - {os: ubuntu-latest, r: 'oldrel'} - - env: - R_REMOTES_NO_ERRORS_FROM_WARNINGS: true - RSPM: ${{ matrix.config.rspm }} - R_FUTURE_PLAN: ${{ matrix.config.future_plan }} - - steps: - - uses: actions/checkout@v3 - - - uses: r-lib/actions/setup-r@v2 - with: - r-version: ${{ matrix.config.r }} - - - uses: r-lib/actions/setup-pandoc@v2 - - - name: Query dependencies - run: | - install.packages('remotes') - saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) - shell: Rscript {0} - - - name: Cache R packages - if: runner.os != 'Windows' - uses: actions/cache@v3 - with: - path: ${{ env.R_LIBS_USER }} - key: ${{ runner.os }}-r-${{ matrix.config.r }}-1-${{ hashFiles('.github/depends.Rds') }} - restore-keys: ${{ runner.os }}-r-${{ matrix.config.r }}-1- - - # - name: "[Linux] Install required system libs" - # if: runner.os == 'Linux' - # run: sudo apt install libcurl4-openssl-dev libgit2-dev - # - # - name: "[Custom block] [Linux] Install spatial libraries" - # if: runner.os == 'Linux' - # run: sudo apt-get install libgdal-dev libproj-dev libgeos-dev libudunits2-dev - - # Try to automatically check for system dependencies and install them - # Note: this might not catch all required system libs and manual action might be needed - # - name: "[Stage] [Linux] Install linux system dependencies" - # if: runner.os == 'Linux' - # run: | - # while read -r cmd - # do - # eval sudo $cmd - # done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))') - - - name: Install dependencies - run: | - remotes::install_deps(dependencies = TRUE) - remotes::install_cran("rcmdcheck") - shell: Rscript {0} - - # # this section again is for sf - # - name: Install rgdal with configure - # if: runner.os == 'macOS' - # run: | - # install.packages("rgdal", type = "source", configure.args = "--with-proj-lib=/usr/local/lib/ --with-proj-include=/usr/local/include/") - # shell: Rscript {0} - - - name: Check - env: - _R_CHECK_CRAN_INCOMING_: false - run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check") - shell: Rscript {0} - - - name: Upload check results - if: failure() - uses: actions/upload-artifact@v3 - with: - name: ${{ runner.os }}-r${{ matrix.config.r }}-results - path: check From 44ba36971e9f8c2a7f7af2f090ba8987816fc6c6 Mon Sep 17 00:00:00 2001 From: Graeme Blair Date: Tue, 10 Dec 2024 19:44:42 -0800 Subject: [PATCH 03/14] ed --- .github/workflows/R-CMD-check.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 562fe0f..c7929d5 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -28,6 +28,7 @@ jobs: env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} R_KEEP_PKG_SOURCE: yes + RGL_USE_NULL: true steps: - uses: actions/checkout@v4 From a71c37f405b70f2849fd84129f98ebe5ecc3101a Mon Sep 17 00:00:00 2001 From: Graeme Blair Date: Tue, 10 Dec 2024 21:01:48 -0800 Subject: [PATCH 04/14] donttest -> dontrun --- R/get_replication_file.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/get_replication_file.R b/R/get_replication_file.R index d2c5cfe..0c50f16 100644 --- a/R/get_replication_file.R +++ b/R/get_replication_file.R @@ -157,7 +157,7 @@ #' #' @examples #' -#' \donttest{ +#' \dontrun{ #' # Requires internet access #' if(curl::has_internet()) { #' diagnosis_2.1 <- get_rdss_file("diagnosis_2.1") From 6127e826fd650ec11a0d7bab768ec78eed4aabd3 Mon Sep 17 00:00:00 2001 From: Graeme Blair Date: Tue, 10 Dec 2024 22:06:30 -0800 Subject: [PATCH 05/14] docs --- man/get_rdss_file.Rd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/get_rdss_file.Rd b/man/get_rdss_file.Rd index 437141c..c0c5646 100644 --- a/man/get_rdss_file.Rd +++ b/man/get_rdss_file.Rd @@ -163,7 +163,7 @@ diagnosis_23a \cr } \examples{ -\donttest{ +\dontrun{ # Requires internet access if(curl::has_internet()) { diagnosis_2.1 <- get_rdss_file("diagnosis_2.1") From ac2953c0ba6ef209fbdf21604bc66cdaab558399 Mon Sep 17 00:00:00 2001 From: Graeme Blair Date: Tue, 10 Dec 2024 22:07:00 -0800 Subject: [PATCH 06/14] deprecate tidy_stan --- R/helpers-stanreg.R | 20 +++++++------------- man/tidy_stan.Rd | 4 ++-- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/R/helpers-stanreg.R b/R/helpers-stanreg.R index d759999..fd4eaf0 100644 --- a/R/helpers-stanreg.R +++ b/R/helpers-stanreg.R @@ -2,35 +2,29 @@ #' Tidy results from a stanreg regression and exponentiate the estimated coefficient #' -#' Note no standard errors or other summary statistics are provided +#' This function is deprecated. Please use the 'tidy' function from the 'broom.mixed' package. #' #' See https://book.declaredesign.org/choosing-an-answer-strategy.html#bayesian-formalizations #' #' @param x A stanreg fit from stan_glm #' @param conf.int Logical indicating whether or not to include a confidence interval in the tidied output. Defaults to FALSE. #' @param conf.level The confidence level to use for the confidence interval if conf.int = TRUE. Must be strictly greater than 0 and less than 1. Defaults to 0.95, which corresponds to a 95 percent confidence interval. -#' @param exponentiate Logical indicating whether or not to exponentiate the the coefficient estimates. Defaults to FALSE. Note that standard errors are not included when \code{exponentiate = TRUE}. +#' @param exponentiate Logical indicating whether or not to exponentiate the the coefficient estimates. Defaults to FALSE. #' @param ... Other arguments to broom.mixed::tidy #' #' @return data.frame of results #' #' @export tidy_stan <- function(x, conf.int = FALSE, conf.level = 0.95, exponentiate = FALSE, ...) { + + message("This function is deprecated. Please use the 'tidy' function from the 'broom.mixed' package.") + if(!requireNamespace("broom.mixed")){ - message("The tidy_exponentiate function requires the 'broom.mixed' package.") + message("The tidy_stan function requires the 'broom.mixed' package.") return(invisible()) } - ret <- broom.mixed::tidy(x, conf.int = conf.int, conf.level = conf.level, ...) - - if (exponentiate) { - ret$estimate <- exp(ret$estimate) - if("conf.low" %in% colnames(ret)){ - ret$conf.low <- exp(ret$conf.low) - ret$conf.high <- exp(ret$conf.high) - } - ret$std.error <- NULL - } + ret <- broom.mixed::tidy(x, conf.int = conf.int, conf.level = conf.level, exponentiate = exponentiate, ...) ret } diff --git a/man/tidy_stan.Rd b/man/tidy_stan.Rd index 9b518b3..2952dda 100644 --- a/man/tidy_stan.Rd +++ b/man/tidy_stan.Rd @@ -16,7 +16,7 @@ tidy_stan(x, conf.int = FALSE, conf.level = 0.95, exponentiate = FALSE, ...) \item{conf.level}{The confidence level to use for the confidence interval if conf.int = TRUE. Must be strictly greater than 0 and less than 1. Defaults to 0.95, which corresponds to a 95 percent confidence interval.} -\item{exponentiate}{Logical indicating whether or not to exponentiate the the coefficient estimates. Defaults to FALSE. Note that standard errors are not included when \code{exponentiate = TRUE}.} +\item{exponentiate}{Logical indicating whether or not to exponentiate the the coefficient estimates. Defaults to FALSE.} \item{...}{Other arguments to broom.mixed::tidy} } @@ -28,7 +28,7 @@ data.frame of results \description{ Note no standard errors or other summary statistics are provided -Note no standard errors or other summary statistics are provided +This function is deprecated. Please use the 'tidy' function from the 'broom.mixed' package. } \details{ See https://book.declaredesign.org/choosing-an-answer-strategy.html#bayesian-formalizations From fda50c76b25883fd1c2835c8cb7ab9f1690383bd Mon Sep 17 00:00:00 2001 From: Graeme Blair Date: Tue, 10 Dec 2024 22:08:32 -0800 Subject: [PATCH 07/14] github actions --- .github/workflows/R-CMD-check.yaml | 52 +++++++++++++++ .github/workflows/r.yml | 101 ----------------------------- 2 files changed, 52 insertions(+), 101 deletions(-) create mode 100644 .github/workflows/R-CMD-check.yaml delete mode 100644 .github/workflows/r.yml diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml new file mode 100644 index 0000000..c7929d5 --- /dev/null +++ b/.github/workflows/R-CMD-check.yaml @@ -0,0 +1,52 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +on: + push: + branches: [main, master] + pull_request: + +name: R-CMD-check.yaml + +permissions: read-all + +jobs: + R-CMD-check: + runs-on: ${{ matrix.config.os }} + + name: ${{ matrix.config.os }} (${{ matrix.config.r }}) + + strategy: + fail-fast: false + matrix: + config: + - {os: macos-latest, r: 'release'} + - {os: windows-latest, r: 'release'} + - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} + - {os: ubuntu-latest, r: 'release'} + - {os: ubuntu-latest, r: 'oldrel-1'} + + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + R_KEEP_PKG_SOURCE: yes + RGL_USE_NULL: true + + steps: + - uses: actions/checkout@v4 + + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-r@v2 + with: + r-version: ${{ matrix.config.r }} + http-user-agent: ${{ matrix.config.http-user-agent }} + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::rcmdcheck + 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.yml b/.github/workflows/r.yml deleted file mode 100644 index 2f19a0d..0000000 --- a/.github/workflows/r.yml +++ /dev/null @@ -1,101 +0,0 @@ -on: - push: - branches: - - main - pull_request: - branches: - - main - -name: R-CMD-check - -jobs: - R-CMD-check: - runs-on: ${{ matrix.config.os }} - - name: ${{ matrix.config.os }} (${{ matrix.config.r }}) - - strategy: - fail-fast: false - matrix: - config: - - {os: macOS-latest, r: 'devel'} - - {os: macOS-latest, r: 'release'} - - {os: macOS-latest, r: 'oldrel'} - - {os: windows-latest, r: 'devel'} - - {os: windows-latest, r: 'release'} - - {os: windows-latest, r: 'oldrel'} - - {os: ubuntu-latest, r: 'devel'} - - {os: ubuntu-latest, r: 'release'} - - {os: ubuntu-latest, r: 'oldrel'} - - env: - R_REMOTES_NO_ERRORS_FROM_WARNINGS: true - RSPM: ${{ matrix.config.rspm }} - R_FUTURE_PLAN: ${{ matrix.config.future_plan }} - - steps: - - uses: actions/checkout@v3 - - - uses: r-lib/actions/setup-r@v2 - with: - r-version: ${{ matrix.config.r }} - - - uses: r-lib/actions/setup-pandoc@v2 - - - name: Query dependencies - run: | - install.packages('remotes') - saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) - shell: Rscript {0} - - - name: Cache R packages - if: runner.os != 'Windows' - uses: actions/cache@v3 - with: - path: ${{ env.R_LIBS_USER }} - key: ${{ runner.os }}-r-${{ matrix.config.r }}-1-${{ hashFiles('.github/depends.Rds') }} - restore-keys: ${{ runner.os }}-r-${{ matrix.config.r }}-1- - - # - name: "[Linux] Install required system libs" - # if: runner.os == 'Linux' - # run: sudo apt install libcurl4-openssl-dev libgit2-dev - # - # - name: "[Custom block] [Linux] Install spatial libraries" - # if: runner.os == 'Linux' - # run: sudo apt-get install libgdal-dev libproj-dev libgeos-dev libudunits2-dev - - # Try to automatically check for system dependencies and install them - # Note: this might not catch all required system libs and manual action might be needed - # - name: "[Stage] [Linux] Install linux system dependencies" - # if: runner.os == 'Linux' - # run: | - # while read -r cmd - # do - # eval sudo $cmd - # done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))') - - - name: Install dependencies - run: | - remotes::install_deps(dependencies = TRUE) - remotes::install_cran("rcmdcheck") - shell: Rscript {0} - - # # this section again is for sf - # - name: Install rgdal with configure - # if: runner.os == 'macOS' - # run: | - # install.packages("rgdal", type = "source", configure.args = "--with-proj-lib=/usr/local/lib/ --with-proj-include=/usr/local/include/") - # shell: Rscript {0} - - - name: Check - env: - _R_CHECK_CRAN_INCOMING_: false - run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check") - shell: Rscript {0} - - - name: Upload check results - if: failure() - uses: actions/upload-artifact@v3 - with: - name: ${{ runner.os }}-r${{ matrix.config.r }}-results - path: check From 21e2e03b822cc5018a59162b0d1df8dec35aa66b Mon Sep 17 00:00:00 2001 From: Graeme Blair Date: Tue, 10 Dec 2024 22:09:29 -0800 Subject: [PATCH 08/14] NEWS --- NEWS.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS.md b/NEWS.md index e3c58ce..c3d927a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# rdss 1.0.14 + +* deprecates tidy_stan in favor of new broom.mixed::tidy function + # rdss 1.0.12 * address bugs with future package From 1a665945819f7d6565cc3de429315422d362441a Mon Sep 17 00:00:00 2001 From: Graeme Blair Date: Fri, 3 Jan 2025 15:13:18 -0800 Subject: [PATCH 09/14] cran up --- DESCRIPTION | 2 +- NEWS.md | 1 + rdss.Rproj | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index b309bec..008afc1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: rdss Title: Companion Datasets and Functions for Research Design in the Social Sciences -Version: 1.0.12 +Version: 1.0.14 Authors@R: c(person("Graeme", "Blair", email = "graeme.blair@gmail.com", role = c("aut", "cre"), comment = c(ORCID = "0000-0001-9164-2102")), person("Alexander", "Coppock", email = "acoppock@gmail.com", role = c("aut"), comment = c(ORCID = "0000-0002-5733-2386")), diff --git a/NEWS.md b/NEWS.md index c3d927a..b1ce05c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,6 @@ # rdss 1.0.14 +* fixes issue with intermittent test failure * deprecates tidy_stan in favor of new broom.mixed::tidy function # rdss 1.0.12 diff --git a/rdss.Rproj b/rdss.Rproj index 239a455..4f34d3e 100644 --- a/rdss.Rproj +++ b/rdss.Rproj @@ -1,4 +1,5 @@ Version: 1.0 +ProjectId: 7cca6168-e54d-486c-99b7-b0664e7caddd RestoreWorkspace: No SaveWorkspace: No From 285f06bd9401d6a49547dc6711b1a4d4a4357c22 Mon Sep 17 00:00:00 2001 From: Graeme Blair Date: Fri, 3 Jan 2025 15:15:25 -0800 Subject: [PATCH 10/14] cran comments --- cran-comments.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cran-comments.md b/cran-comments.md index 5318252..978c751 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,13 +1,13 @@ ## Submission -rdss 1.0.10 was archived off CRAN, principally because the `prediction` package was archived. This version switches to the `marginaleffects` package. +rdss 1.0.12 was archived off CRAN, due to an issue which was intermittent in the Additional_issues on CRAN. This has been fixed. ## Test environments * local OS X install (release) * ubuntu on github actions (devel, release, oldrel) -* windows on github actions (devel, release, oldrel) -* OS X on Github actions (devel, release, oldrel) +* windows on github actions (release) +* OS X on Github actions (release) * win-builder (devel, release, oldrel) ## R CMD check results From c20d8f67e47f14ff74971db4935213a5bbe4a9f4 Mon Sep 17 00:00:00 2001 From: Graeme Blair Date: Fri, 3 Jan 2025 15:21:13 -0800 Subject: [PATCH 11/14] ed --- DESCRIPTION | 3 ++- NAMESPACE | 1 - R/helpers-multilevel-regression-poststratification.R | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 008afc1..5debd04 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -6,7 +6,7 @@ Authors@R: person("Alexander", "Coppock", email = "acoppock@gmail.com", role = c("aut"), comment = c(ORCID = "0000-0002-5733-2386")), person("Macartan", "Humphreys", email = "macartan@gmail.com", role = c("aut"), comment = c(ORCID = "0000-0001-7029-2326"))) Description: Helper functions to accompany the Blair, Coppock, and Humphreys (2022) "Research Design in the Social Sciences: Declaration, Diagnosis, and Redesign" . 'rdss' includes datasets, helper functions, and plotting components to enable use and replication of the book. -Imports: dplyr, rlang (>= 1.0.0), generics, ggplot2, tibble, tidyr, dataverse, readr, marginaleffects, broom, purrr, estimatr, randomizr +Imports: dplyr, rlang (>= 1.0.0), generics, ggplot2, tibble, tidyr, dataverse, readr, broom, purrr, estimatr, randomizr License: MIT + file LICENSE Encoding: UTF-8 LazyData: true @@ -17,6 +17,7 @@ Suggests: rdrobust, DIDmultiplegt, broom.mixed, + marginaleffects, grf, CausalQueries, metafor, diff --git a/NAMESPACE b/NAMESPACE index 3258d65..cd61cf6 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -53,7 +53,6 @@ importFrom(ggplot2,element_text) importFrom(ggplot2,margin) importFrom(ggplot2,theme) importFrom(ggplot2,theme_minimal) -importFrom(marginaleffects,predictions) importFrom(purrr,as_vector) importFrom(purrr,map) importFrom(purrr,map_chr) diff --git a/R/helpers-multilevel-regression-poststratification.R b/R/helpers-multilevel-regression-poststratification.R index 737801d..c42e2dd 100644 --- a/R/helpers-multilevel-regression-poststratification.R +++ b/R/helpers-multilevel-regression-poststratification.R @@ -13,12 +13,17 @@ #' #' @export #' -#' @importFrom marginaleffects predictions #' @importFrom dplyr group_by summarize #' @importFrom stats weighted.mean #' @importFrom rlang `!!` enquo #' post_stratification_helper <- function(model_fit, data, group, weights) { + + if(!requireNamespace("marginaleffects")){ + message("The post_stratification_helper function requires the 'marginaleffects' package.") + return(invisible()) + } + predictions( model_fit, newdata = data, From 2d62405a058e729d74f52e09dc7c37efb6d86533 Mon Sep 17 00:00:00 2001 From: Graeme Blair Date: Fri, 3 Jan 2025 15:22:30 -0800 Subject: [PATCH 12/14] ed --- R/helpers-multilevel-regression-poststratification.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/helpers-multilevel-regression-poststratification.R b/R/helpers-multilevel-regression-poststratification.R index c42e2dd..f6ed7a6 100644 --- a/R/helpers-multilevel-regression-poststratification.R +++ b/R/helpers-multilevel-regression-poststratification.R @@ -24,7 +24,7 @@ post_stratification_helper <- function(model_fit, data, group, weights) { return(invisible()) } - predictions( + marginaleffects::predictions( model_fit, newdata = data, type = "response", From a9b8be8e63c000ea11d43be156e4b17770fa9c21 Mon Sep 17 00:00:00 2001 From: Graeme Blair Date: Fri, 3 Jan 2025 15:44:59 -0800 Subject: [PATCH 13/14] submitted to CRAN --- CRAN-SUBMISSION | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 CRAN-SUBMISSION diff --git a/CRAN-SUBMISSION b/CRAN-SUBMISSION new file mode 100644 index 0000000..8e8141c --- /dev/null +++ b/CRAN-SUBMISSION @@ -0,0 +1,3 @@ +Version: 1.0.14 +Date: 2025-01-03 23:44:51 UTC +SHA: 2d62405a058e729d74f52e09dc7c37efb6d86533 From 57cd838b5a17a40a019b6fd15e11836debb28434 Mon Sep 17 00:00:00 2001 From: Graeme Blair Date: Wed, 8 Jan 2025 19:31:57 -0800 Subject: [PATCH 14/14] resubmission --- CRAN-SUBMISSION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CRAN-SUBMISSION b/CRAN-SUBMISSION index 8e8141c..dee0ae5 100644 --- a/CRAN-SUBMISSION +++ b/CRAN-SUBMISSION @@ -1,3 +1,3 @@ Version: 1.0.14 -Date: 2025-01-03 23:44:51 UTC -SHA: 2d62405a058e729d74f52e09dc7c37efb6d86533 +Date: 2025-01-09 03:31:52 UTC +SHA: a9b8be8e63c000ea11d43be156e4b17770fa9c21