Skip to content

Commit e4e2e0c

Browse files
authored
Merge pull request #68 from ehrlinger/pkgdown-site
Add vignette for Random Forest Survival Analysis and update DESCRIPTION
2 parents 0139b5c + a44d9d0 commit e4e2e0c

33 files changed

Lines changed: 2555 additions & 211 deletions

.Rbuildignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ framed.sty
3434
^doc$
3535
^Meta$
3636
^_pkgdown\.yml$
37+
^codecov\.yml$
3738
^docs$
3839
^pkgdown$
3940
^LICENSE\.md$

.claude/settings.local.json

Lines changed: 0 additions & 15 deletions
This file was deleted.

.github/workflows/R-CMD-check.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ jobs:
2424
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
2525
- {os: ubuntu-latest, r: 'release'}
2626
- {os: ubuntu-latest, r: 'oldrel-1'}
27+
# R-devel may fail due to upstream packages not yet compatible with
28+
# the development version of R (e.g. lazyeval PREXPR removal).
29+
continue-on-error: ${{ matrix.config.r == 'devel' }}
2730

2831
env:
2932
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
@@ -47,13 +50,25 @@ jobs:
4750
use-public-rspm: true
4851
rtools-version: '44'
4952

53+
# On R-devel, bootstrap rcmdcheck before the main lockfile install so that
54+
# the check step can run even when abandoned packages (e.g. lazyeval) that
55+
# use removed C symbols (PREXPR) cause pak::lockfile_install() to abort.
56+
- name: Bootstrap rcmdcheck (R-devel only)
57+
if: matrix.config.r == 'devel'
58+
run: install.packages("rcmdcheck")
59+
shell: Rscript {0}
60+
61+
# R-devel may fail here due to lazyeval PREXPR; rcmdcheck is pre-installed
62+
# above so the check step still runs regardless.
5063
- uses: r-lib/actions/setup-r-dependencies@v2
64+
continue-on-error: ${{ matrix.config.r == 'devel' }}
5165
with:
5266
extra-packages: any::rcmdcheck
5367
cache-version: 2
5468
needs: check
5569

5670
- uses: r-lib/actions/check-r-package@v2
71+
continue-on-error: ${{ matrix.config.r == 'devel' }}
5772
with:
5873
upload-snapshots: true
5974
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'

.github/workflows/check-standard.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ jobs:
2323
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
2424
- {os: ubuntu-latest, r: 'release'}
2525
- {os: ubuntu-latest, r: 'oldrel-1'}
26+
# R-devel may fail due to upstream packages not yet compatible with
27+
# the development version of R (e.g. lazyeval PREXPR removal).
28+
continue-on-error: ${{ matrix.config.r == 'devel' }}
2629

2730
env:
2831
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
@@ -41,10 +44,23 @@ jobs:
4144
use-public-rspm: true
4245
rtools-version: '42'
4346

47+
# On R-devel, bootstrap rcmdcheck before the main lockfile install so that
48+
# the check step can run even when abandoned packages (e.g. lazyeval) that
49+
# use removed C symbols (PREXPR) cause pak::lockfile_install() to abort.
50+
- name: Bootstrap rcmdcheck (R-devel only)
51+
if: matrix.config.r == 'devel'
52+
run: install.packages("rcmdcheck")
53+
shell: Rscript {0}
54+
55+
# R-devel may fail here due to lazyeval PREXPR; rcmdcheck is pre-installed
56+
# above so the check step still runs regardless.
4457
- uses: r-lib/actions/setup-r-dependencies@v2
58+
continue-on-error: ${{ matrix.config.r == 'devel' }}
4559
with:
4660
extra-packages: rcmdcheck
4761
cache-version: 2
4862

4963
- uses: r-lib/actions/setup-tinytex@v2
64+
5065
- uses: r-lib/actions/check-r-package@v2
66+
continue-on-error: ${{ matrix.config.r == 'devel' }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,4 @@ docs
4646
vignettes/ggRandomForests_files
4747
vignettes/ggRandomForests.html
4848

49+
.claude

DESCRIPTION

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Package: ggRandomForests
22
Type: Package
33
Title: Visually Exploring Random Forests
4-
Version: 2.7.0
5-
Date: 2026-03-25
4+
Version: 2.7.0.9001
5+
Date: 2026-03-27
66
Authors@R: person("John", "Ehrlinger",
77
role = c("aut", "cre"),
88
email = "john.ehrlinger@gmail.com")
@@ -35,6 +35,8 @@ Suggests:
3535
rmarkdown,
3636
quarto,
3737
pkgdown,
38-
pkgload
38+
pkgload,
39+
knitr,
40+
plotly
3941
VignetteBuilder: quarto
4042
RoxygenNote: 7.3.3

NAMESPACE

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,16 @@ S3method(gg_rfsrc,rfsrc)
1010
S3method(gg_roc,default)
1111
S3method(gg_roc,randomForest)
1212
S3method(gg_roc,rfsrc)
13+
S3method(gg_survival,default)
14+
S3method(gg_survival,rfsrc)
1315
S3method(gg_variable,randomForest)
1416
S3method(gg_variable,rfsrc)
1517
S3method(gg_vimp,randomForest)
1618
S3method(gg_vimp,rfsrc)
1719
S3method(plot,gg_error)
20+
S3method(plot,gg_partial)
21+
S3method(plot,gg_partial_rfsrc)
22+
S3method(plot,gg_partialpro)
1823
S3method(plot,gg_rfsrc)
1924
S3method(plot,gg_roc)
2025
S3method(plot,gg_survival)

NEWS.md

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,53 @@
11
Package: ggRandomForests
2-
Version: 2.7.0
2+
Version: 2.8.0
3+
4+
ggRandomForests v2.8.0
5+
=====================
6+
* S3 design overhaul: `gg_partial()`, `gg_partialpro()`, and
7+
`gg_partial_rfsrc()` now stamp their return values with S3 classes
8+
(`gg_partial`, `gg_partialpro`, `gg_partial_rfsrc` respectively), enabling
9+
`plot()` dispatch without any boilerplate.
10+
* Add `plot.gg_partial()`, `plot.gg_partial_rfsrc()`, and
11+
`plot.gg_partialpro()` S3 methods; continuous predictors render as line
12+
plots, categorical as bar charts, faceted by variable name. Survival
13+
forests produce curves over time; two-variable surface plots group by
14+
`xvar2.name`.
15+
* Convert `gg_survival()` to an S3 generic dispatching on the class of its
16+
first argument. New `gg_survival.rfsrc()` method extracts the survival
17+
response directly from the fitted forest (no separate data argument
18+
needed); `gg_survival.default()` preserves the existing interface.
19+
* Fix `plot.gg_survival()` auto-coercion: previously called
20+
`gg_survival(rfsrc_obj)` treating the forest as the `interval` string
21+
argument, causing a latent crash; replaced with `inherits()` guard.
22+
* Deprecate `surv_partial.rfsrc()` via `.Deprecated()` with a pointer to
23+
`gg_partial_rfsrc()`; all package tests updated to suppress the warning.
24+
* Fix `gg_partial_rfsrc()``make_eval_grid()` used `unlist(dplyr::select())`
25+
which coerced factor columns to integer codes; now uses `newx[[xname]]` to
26+
preserve column class. Categorical detection extended to cover
27+
`is.factor()` and `is.character()` in addition to the cardinality check.
28+
* Add guards to `gg_partial_rfsrc()`: all-NA `xval` after NA removal now
29+
emits a warning and skips the variable; all-NA grouping variable (`xvar2`)
30+
calls `stop()`; `n_eval` and `cat_limit` are validated as single integers
31+
>= 2 near function entry.
32+
* Fix cyclomatic complexity across `gg_partial_rfsrc.R`: refactored into
33+
eight top-level unexported helpers (`validate_scalar_int`,
34+
`validate_partial_args`, `snap_partial_time`, `make_eval_grid`,
35+
`call_partial_rfsrc`, `partial_one_var`, `partial_no_group`,
36+
`partial_with_group`, `split_partial_result`); all functions now score
37+
below the `cyclocomp_linter` limit of 20.
38+
* Fix `@param partial.time` documentation: "see the section above" corrected
39+
to "see the section below".
40+
* Replace deprecated `tidyr::gather()` with `tidyr::pivot_longer()` in
41+
`plot.gg_vimp()` and `plot.gg_partialpro()`.
42+
* Add `gg_survival.rfsrc`, `gg_survival.default`, `plot.gg_partial`,
43+
`plot.gg_partial_rfsrc`, and `plot.gg_partialpro` to `NAMESPACE`; add
44+
corresponding `@rdname` / `@export` roxygen tags.
45+
* Update tests: add `expect_s3_class()` checks for all new classes; add
46+
`plot()` smoke tests for `gg_partial`, `gg_partial_rfsrc`, `gg_partialpro`;
47+
add `gg_survival.rfsrc` tests for KM extraction, `by` stratification, and
48+
error on non-survival forest.
49+
* Add `plot.gg_partial`, `plot.gg_partial_rfsrc`, and `plot.gg_partialpro`
50+
to `_pkgdown.yml` reference index.
351

452
ggRandomForests v2.7.0
553
=====================

R/gg_partial.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,5 +111,7 @@ gg_partial <- function(part_dta,
111111
}
112112
}
113113

114-
return(list(continuous = continuous, categorical = categorical))
114+
result <- list(continuous = continuous, categorical = categorical)
115+
class(result) <- "gg_partial"
116+
return(result)
115117
}

0 commit comments

Comments
 (0)