Skip to content

Commit

Permalink
Merge pull request #120 from tidymodels/upkeep-2024
Browse files Browse the repository at this point in the history
Upkeep 2024
  • Loading branch information
EmilHvitfeldt authored Nov 22, 2024
2 parents 87bacbf + fde4246 commit c923353
Show file tree
Hide file tree
Showing 27 changed files with 67 additions and 67 deletions.
19 changes: 5 additions & 14 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
# 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
#
# NOTE: This workflow is overkill for most R packages and
# check-standard.yaml is likely a better choice.
# usethis::use_github_action("check-standard") will install it.
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

name: R-CMD-check
name: R-CMD-check.yaml

permissions: read-all

jobs:
R-CMD-check:
Expand All @@ -23,24 +20,17 @@ jobs:
matrix:
config:
- {os: macos-latest, r: 'release'}

- {os: windows-latest, r: 'release'}
# Use 3.6 to trigger usage of RTools35
- {os: windows-latest, r: '3.6'}
# use 4.1 to check with rtools40's older compiler
- {os: windows-latest, r: '4.1'}

- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}
- {os: ubuntu-latest, r: 'oldrel-2'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

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

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

Expand All @@ -58,3 +48,4 @@ jobs:
- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
9 changes: 5 additions & 4 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
release:
types: [published]
workflow_dispatch:

name: pkgdown
name: pkgdown.yaml

permissions: read-all

jobs:
pkgdown:
Expand All @@ -22,7 +23,7 @@ jobs:
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

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

Expand All @@ -41,7 +42,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
25 changes: 18 additions & 7 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

name: test-coverage
name: test-coverage.yaml

permissions: read-all

jobs:
test-coverage:
Expand All @@ -15,36 +16,46 @@ 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
extra-packages: any::covr, any::xml2
needs: coverage

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

- uses: codecov/codecov-action@v4
with:
# Fail if error if not on PR, or if on PR and token is given
fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }}
file: ./cobertura.xml
plugin: noop
disable_search: true
token: ${{ secrets.CODECOV_TOKEN }}

- 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
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,5 @@ VignetteBuilder:
Config/Needs/website: tidyverse/tidytemplate
Config/testthat/edition: 3
Encoding: UTF-8
RoxygenNote: 7.2.3
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.2
34 changes: 34 additions & 0 deletions R/model-glm.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Predict ---------------------------------------

#' @export
tidypredict_fit.glm <- function(model) {
parsedmodel <- parse_model(model)
build_fit_formula(parsedmodel)
}

# Parse model --------------------------------------

#' @export
parse_model.glm <- function(model) parse_model_lm(model)

# Intervals -----------------------------------------------

#' @export
tidypredict_interval.glm <- function(model, interval = 0.95) {
parsedmodel <- parse_model(model)
te_interval_glm(parsedmodel, interval)
}

te_interval_glm <- function(parsedmodel, interval = 0.95) {
intervals <- te_interval_lm(parsedmodel, interval)
family <- parsedmodel$general$family
link <- parsedmodel$general$link
assigned <- 0
if (family == "gaussian" && link == "identity") {
assigned <- 1
}
if (assigned == 0) {
cli::cli_abort("Combination of family and link are not supported for prediction intervals")
}
intervals
}
29 changes: 0 additions & 29 deletions R/model-lm.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ tidypredict_fit.lm <- function(model) {
build_fit_formula(parsedmodel)
}

#' @export
tidypredict_fit.glm <- function(model) {
parsedmodel <- parse_model(model)
build_fit_formula(parsedmodel)
}

build_fit_formula <- function(parsedmodel) {
parsed_f <- map(
parsedmodel$terms,
Expand Down Expand Up @@ -77,9 +71,6 @@ build_fit_formula <- function(parsedmodel) {
#' @export
parse_model.lm <- function(model) parse_model_lm(model)

#' @export
parse_model.glm <- function(model) parse_model_lm(model)

parse_model_lm <- function(model) {
acceptable_formula(model)

Expand Down Expand Up @@ -167,12 +158,6 @@ tidypredict_interval.lm <- function(model, interval = 0.95) {
te_interval_lm(parsedmodel, interval)
}

#' @export
tidypredict_interval.glm <- function(model, interval = 0.95) {
parsedmodel <- parse_model(model)
te_interval_glm(parsedmodel, interval)
}

get_qr_lm <- function(qr_name, parsedmodel) {
q <- map(
parsedmodel$terms,
Expand Down Expand Up @@ -225,17 +210,3 @@ te_interval_lm <- function(parsedmodel, interval = 0.95) {
tfrac <- qt(1 - (1 - 0.95) / 2, parsedmodel$general$residual)
expr(!!tfrac * sqrt((!!qrs) + (!!parsedmodel$general$sigma2)))
}

te_interval_glm <- function(parsedmodel, interval = 0.95) {
intervals <- te_interval_lm(parsedmodel, interval)
family <- parsedmodel$general$family
link <- parsedmodel$general$link
assigned <- 0
if (family == "gaussian" && link == "identity") {
assigned <- 1
}
if (assigned == 0) {
cli::cli_abort("Combination of family and link are not supported for prediction intervals")
}
intervals
}
File renamed without changes.
9 changes: 0 additions & 9 deletions cran-comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,6 @@

* Having Max as the maintainer will guarantee good follow through for any communications with CRAN. This is the reason why there is another update is such short order from the previous update in CRAN. Thank you for your understanding.

## Test environments

* macOS M1. R: 4.2.1
* macOS R: Release
* Windows R: Release
* Windows R: 3.6
* Ubuntu 18.04 R: Release
* Ubuntu 18.04 R: Devel

## R CMD check results

* 0 errors | 0 warnings | 0 notes
Expand Down
2 changes: 1 addition & 1 deletion man/knit_print.tidypredict_test.Rd

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

2 changes: 1 addition & 1 deletion man/print.tidypredict_test.Rd

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

2 changes: 1 addition & 1 deletion man/tidypredict_test.Rd

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

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit c923353

Please sign in to comment.