Skip to content

Commit

Permalink
Merge pull request #10 from DeclareDesign/internet-on-cran-issue
Browse files Browse the repository at this point in the history
internet on cran issue
  • Loading branch information
graemeblair authored Jan 12, 2025
2 parents e8eec55 + 57cd838 commit c2e27b0
Show file tree
Hide file tree
Showing 14 changed files with 87 additions and 130 deletions.
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
52 changes: 52 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -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")'
101 changes: 0 additions & 101 deletions .github/workflows/r.yml

This file was deleted.

6 changes: 3 additions & 3 deletions CRAN-SUBMISSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Version: 1.0.12
Date: 2024-10-07 18:00:19 UTC
SHA: 1802077891d79bc7df8b64a7d51448970b34ea27
Version: 1.0.14
Date: 2025-01-09 03:31:52 UTC
SHA: a9b8be8e63c000ea11d43be156e4b17770fa9c21
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
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 = "[email protected]", role = c("aut", "cre"), comment = c(ORCID = "0000-0001-9164-2102")),
person("Alexander", "Coppock", email = "[email protected]", role = c("aut"), comment = c(ORCID = "0000-0002-5733-2386")),
person("Macartan", "Humphreys", email = "[email protected]", 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" <https://book.declaredesign.org>. '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
Expand All @@ -17,6 +17,7 @@ Suggests:
rdrobust,
DIDmultiplegt,
broom.mixed,
marginaleffects,
grf,
CausalQueries,
metafor,
Expand Down
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 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

* address bugs with future package
Expand Down
2 changes: 1 addition & 1 deletion R/get_replication_file.R
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
#'
#' @examples
#'
#' \donttest{
#' \dontrun{
#' # Requires internet access
#' if(curl::has_internet()) {
#' diagnosis_2.1 <- get_rdss_file("diagnosis_2.1")
Expand Down
9 changes: 7 additions & 2 deletions R/helpers-multilevel-regression-poststratification.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,18 @@
#'
#' @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) {
predictions(

if(!requireNamespace("marginaleffects")){
message("The post_stratification_helper function requires the 'marginaleffects' package.")
return(invisible())
}

marginaleffects::predictions(
model_fit,
newdata = data,
type = "response",
Expand Down
20 changes: 7 additions & 13 deletions R/helpers-stanreg.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
6 changes: 3 additions & 3 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion man/get_rdss_file.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/tidy_stan.Rd

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

3 changes: 2 additions & 1 deletion rdss.Rproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
Version: 1.0
ProjectId: 7cca6168-e54d-486c-99b7-b0664e7caddd

RestoreWorkspace: No
SaveWorkspace: No
AlwaysSaveHistory: Default
AlwaysSaveHistory: No

EnableCodeIndexing: Yes
UseSpacesForTab: Yes
Expand Down

0 comments on commit c2e27b0

Please sign in to comment.