Skip to content

Commit

Permalink
also check without suggested packages (#306)
Browse files Browse the repository at this point in the history
* also check without suggested packages

* skips for suggested pkgs

* examples only when engine pkgs available
  • Loading branch information
hfrick authored Jan 24, 2024
1 parent 28cb885 commit b9febd6
Show file tree
Hide file tree
Showing 22 changed files with 94 additions and 11 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/R-CMD-check-hard.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# 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 only directly installs "hard" dependencies, i.e. Depends,
# Imports, and LinkingTo dependencies. Notably, Suggests dependencies are never
# installed, with the exception of testthat, knitr, and rmarkdown. The cache is
# never used to avoid accidentally restoring a cache containing a suggested
# dependency.
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

name: R-CMD-check-hard

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
- {os: ubuntu-latest, r: 'release'}

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

steps:
- uses: actions/checkout@v3

- 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:
dependencies: '"hard"'
cache: false
extra-packages: |
any::rcmdcheck
any::testthat
any::knitr
any::rmarkdown
needs: check

- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
4 changes: 2 additions & 2 deletions R/bag_tree-rpart.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#' @return A vector.
#' @keywords internal
#' @export
#' @examples
#' @examplesIf rlang::is_installed("ipred")
#' bagged_tree <- bag_tree() %>%
#' set_engine("rpart") %>%
#' set_mode("censored regression") %>%
Expand Down Expand Up @@ -61,7 +61,7 @@ get_missings_survbagg <- function(object, new_data) {
#' @return A vctrs list of tibbles.
#' @keywords internal
#' @export
#' @examples
#' @examplesIf rlang::is_installed("ipred")
#' bagged_tree <- bag_tree() %>%
#' set_engine("rpart") %>%
#' set_mode("censored regression") %>%
Expand Down
6 changes: 3 additions & 3 deletions R/boost_tree-mboost.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#' @return A fitted blackboost model.
#' @keywords internal
#' @export
#' @examples
#' @examplesIf rlang::is_installed("mboost")
#' blackboost_train(Surv(time, status) ~ age + ph.ecog,
#' data = lung[-14, ], family = mboost::CoxPH()
#' )
Expand Down Expand Up @@ -111,7 +111,7 @@ predict_linear_pred._blackboost <- function(object,
#' @return A tibble with a list column of nested tibbles.
#' @keywords internal
#' @export
#' @examples
#' @examplesIf rlang::is_installed("mboost")
#' mod <- boost_tree() %>%
#' set_engine("mboost") %>%
#' set_mode("censored regression") %>%
Expand Down Expand Up @@ -176,7 +176,7 @@ survival_curve_to_prob <- function(eval_time, event_times, survival_prob) {
#' @return A tibble.
#' @keywords internal
#' @export
#' @examples
#' @examplesIf rlang::is_installed("mboost")
#' boosted_tree <- boost_tree() %>%
#' set_engine("mboost") %>%
#' set_mode("censored regression") %>%
Expand Down
2 changes: 1 addition & 1 deletion R/decision_tree-rpart.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#' @return A tibble with a list column of nested tibbles.
#' @keywords internal
#' @export
#' @examples
#' @examplesIf rlang::is_installed("pec")
#' mod <- decision_tree() %>%
#' set_mode("censored regression") %>%
#' set_engine("rpart") %>%
Expand Down
2 changes: 1 addition & 1 deletion R/partykit.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#' @return A tibble with a list column of nested tibbles.
#' @export
#' @keywords internal
#' @examples
#' @examplesIf rlang::is_installed(c("partykit", "coin"))
#' tree <- decision_tree() %>%
#' set_mode("censored regression") %>%
#' set_engine("partykit") %>%
Expand Down
6 changes: 3 additions & 3 deletions R/proportional_hazards-glmnet.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#' @return A fitted `glmnet` model.
#' @export
#' @keywords internal
#' @examples
#' @examplesIf rlang::is_installed("glmnet")
#' coxnet_mod <- coxnet_train(Surv(time, status) ~ age + sex, data = lung)
coxnet_train <- function(formula,
data,
Expand Down Expand Up @@ -471,7 +471,7 @@ multi_predict_coxnet_linear_pred <- function(object, new_data, opts, penalty) {
#' @return A vector.
#' @keywords internal
#' @export
#' @examples
#' @examplesIf rlang::is_installed("glmnet")
#' cox_mod <- proportional_hazards(penalty = 0.1) %>%
#' set_engine("glmnet") %>%
#' fit(Surv(time, status) ~ ., data = lung)
Expand Down Expand Up @@ -596,7 +596,7 @@ get_missings_coxnet <- function(new_x, new_strata) {
#' @return A tibble with a list column of nested tibbles.
#' @keywords internal
#' @export
#' @examples
#' @examplesIf rlang::is_installed("glmnet")
#' cox_mod <- proportional_hazards(penalty = 0.1) %>%
#' set_engine("glmnet") %>%
#' fit(Surv(time, status) ~ ., data = lung)
Expand Down
2 changes: 1 addition & 1 deletion R/rand_forest-aorsf.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#' @export
#' @keywords internal
#' @name aorsf_internal
#' @examples
#' @examplesIf rlang::is_installed("aorsf")
#' mod <- rand_forest() %>%
#' set_engine("aorsf") %>%
#' set_mode("censored regression") %>%
Expand Down
1 change: 1 addition & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ knitr::opts_chunk$set(
[![R-CMD-check](https://github.com/tidymodels/censored/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/tidymodels/censored/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/tidymodels/censored/branch/main/graph/badge.svg)](https://app.codecov.io/gh/tidymodels/censored?branch=main)
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html)
[![R-CMD-check-hard](https://github.com/tidymodels/censored/actions/workflows/R-CMD-check-hard.yaml/badge.svg)](https://github.com/tidymodels/censored/actions/workflows/R-CMD-check-hard.yaml)
<!-- badges: end -->

`censored` is a [parsnip](https://parsnip.tidymodels.org) extension package which provides engines for various models for censored regression and survival analysis.
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
coverage](https://codecov.io/gh/tidymodels/censored/branch/main/graph/badge.svg)](https://app.codecov.io/gh/tidymodels/censored?branch=main)
[![Lifecycle:
experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html)
[![R-CMD-check-hard](https://github.com/tidymodels/censored/actions/workflows/R-CMD-check-hard.yaml/badge.svg)](https://github.com/tidymodels/censored/actions/workflows/R-CMD-check-hard.yaml)
<!-- badges: end -->

`censored` is a [parsnip](https://parsnip.tidymodels.org) extension
Expand Down
2 changes: 2 additions & 0 deletions man/aorsf_internal.Rd

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

2 changes: 2 additions & 0 deletions man/blackboost_train.Rd

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

2 changes: 2 additions & 0 deletions man/coxnet_train.Rd

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

2 changes: 2 additions & 0 deletions man/survival_prob_coxnet.Rd

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

2 changes: 2 additions & 0 deletions man/survival_prob_mboost.Rd

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

2 changes: 2 additions & 0 deletions man/survival_prob_partykit.Rd

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

2 changes: 2 additions & 0 deletions man/survival_prob_pecRpart.Rd

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

2 changes: 2 additions & 0 deletions man/survival_prob_survbagg.Rd

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

2 changes: 2 additions & 0 deletions man/survival_time_coxnet.Rd

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

2 changes: 2 additions & 0 deletions man/survival_time_mboost.Rd

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

2 changes: 2 additions & 0 deletions man/survival_time_survbagg.Rd

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

1 change: 1 addition & 0 deletions tests/testthat/test-bag_tree-rpart.R
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ test_that("time predictions without surrogate splits for NA", {
})

test_that("survival_time_survbagg() throws an informative error with an engine object", {
skip_if_not_installed("ipred")
mod <- ipred::bagging(Surv(time, status) ~ age + ph.ecog, data = lung)
expect_snapshot(error = TRUE, {
survival_time_survbagg(mod)
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-proportional_hazards-survival.R
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ test_that("prediction from stratified models require strata variables in new_dat
# prediction: survival ----------------------------------------------------

test_that("survival predictions without strata", {
skip_if_not_installed("pec")
# due to pec:
skip_if_not_installed("Matrix", minimum_version = "1.4.2")

Expand Down

0 comments on commit b9febd6

Please sign in to comment.