From ac2953c0ba6ef209fbdf21604bc66cdaab558399 Mon Sep 17 00:00:00 2001 From: Graeme Blair Date: Tue, 10 Dec 2024 22:07:00 -0800 Subject: [PATCH 1/3] 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 2/3] 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 3/3] 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