Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ framed.sty
^doc$
^Meta$
^_pkgdown\.yml$
^codecov\.yml$
^docs$
^pkgdown$
^LICENSE\.md$
Expand Down
15 changes: 0 additions & 15 deletions .claude/settings.local.json

This file was deleted.

15 changes: 15 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ jobs:
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}
# R-devel may fail due to upstream packages not yet compatible with
# the development version of R (e.g. lazyeval PREXPR removal).
continue-on-error: ${{ matrix.config.r == 'devel' }}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -47,13 +50,25 @@ jobs:
use-public-rspm: true
rtools-version: '44'

# On R-devel, bootstrap rcmdcheck before the main lockfile install so that
# the check step can run even when abandoned packages (e.g. lazyeval) that
# use removed C symbols (PREXPR) cause pak::lockfile_install() to abort.
- name: Bootstrap rcmdcheck (R-devel only)
if: matrix.config.r == 'devel'
run: install.packages("rcmdcheck")
shell: Rscript {0}

# R-devel may fail here due to lazyeval PREXPR; rcmdcheck is pre-installed
# above so the check step still runs regardless.
- uses: r-lib/actions/setup-r-dependencies@v2
continue-on-error: ${{ matrix.config.r == 'devel' }}
with:
extra-packages: any::rcmdcheck
cache-version: 2
needs: check

- uses: r-lib/actions/check-r-package@v2
continue-on-error: ${{ matrix.config.r == 'devel' }}
with:
upload-snapshots: true
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/check-standard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ jobs:
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}
# R-devel may fail due to upstream packages not yet compatible with
# the development version of R (e.g. lazyeval PREXPR removal).
continue-on-error: ${{ matrix.config.r == 'devel' }}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -41,10 +44,23 @@ jobs:
use-public-rspm: true
rtools-version: '42'

# On R-devel, bootstrap rcmdcheck before the main lockfile install so that
# the check step can run even when abandoned packages (e.g. lazyeval) that
# use removed C symbols (PREXPR) cause pak::lockfile_install() to abort.
- name: Bootstrap rcmdcheck (R-devel only)
if: matrix.config.r == 'devel'
run: install.packages("rcmdcheck")
shell: Rscript {0}

# R-devel may fail here due to lazyeval PREXPR; rcmdcheck is pre-installed
# above so the check step still runs regardless.
- uses: r-lib/actions/setup-r-dependencies@v2
continue-on-error: ${{ matrix.config.r == 'devel' }}
with:
extra-packages: rcmdcheck
cache-version: 2

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

- uses: r-lib/actions/check-r-package@v2
continue-on-error: ${{ matrix.config.r == 'devel' }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,4 @@ docs
vignettes/ggRandomForests_files
vignettes/ggRandomForests.html

.claude
8 changes: 5 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: ggRandomForests
Type: Package
Title: Visually Exploring Random Forests
Version: 2.7.0
Date: 2026-03-25
Version: 2.7.0.9001
Date: 2026-03-27
Authors@R: person("John", "Ehrlinger",
role = c("aut", "cre"),
email = "john.ehrlinger@gmail.com")
Expand Down Expand Up @@ -35,6 +35,8 @@ Suggests:
rmarkdown,
quarto,
pkgdown,
pkgload
pkgload,
knitr,
plotly
VignetteBuilder: quarto
RoxygenNote: 7.3.3
5 changes: 5 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,16 @@ S3method(gg_rfsrc,rfsrc)
S3method(gg_roc,default)
S3method(gg_roc,randomForest)
S3method(gg_roc,rfsrc)
S3method(gg_survival,default)
S3method(gg_survival,rfsrc)
S3method(gg_variable,randomForest)
S3method(gg_variable,rfsrc)
S3method(gg_vimp,randomForest)
S3method(gg_vimp,rfsrc)
S3method(plot,gg_error)
S3method(plot,gg_partial)
S3method(plot,gg_partial_rfsrc)
S3method(plot,gg_partialpro)
S3method(plot,gg_rfsrc)
S3method(plot,gg_roc)
S3method(plot,gg_survival)
Expand Down
50 changes: 49 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,53 @@
Package: ggRandomForests
Version: 2.7.0
Version: 2.8.0

ggRandomForests v2.8.0
=====================
* S3 design overhaul: `gg_partial()`, `gg_partialpro()`, and
`gg_partial_rfsrc()` now stamp their return values with S3 classes
(`gg_partial`, `gg_partialpro`, `gg_partial_rfsrc` respectively), enabling
`plot()` dispatch without any boilerplate.
* Add `plot.gg_partial()`, `plot.gg_partial_rfsrc()`, and
`plot.gg_partialpro()` S3 methods; continuous predictors render as line
plots, categorical as bar charts, faceted by variable name. Survival
forests produce curves over time; two-variable surface plots group by
`xvar2.name`.
* Convert `gg_survival()` to an S3 generic dispatching on the class of its
first argument. New `gg_survival.rfsrc()` method extracts the survival
response directly from the fitted forest (no separate data argument
needed); `gg_survival.default()` preserves the existing interface.
* Fix `plot.gg_survival()` auto-coercion: previously called
`gg_survival(rfsrc_obj)` treating the forest as the `interval` string
argument, causing a latent crash; replaced with `inherits()` guard.
* Deprecate `surv_partial.rfsrc()` via `.Deprecated()` with a pointer to
`gg_partial_rfsrc()`; all package tests updated to suppress the warning.
* Fix `gg_partial_rfsrc()` — `make_eval_grid()` used `unlist(dplyr::select())`
which coerced factor columns to integer codes; now uses `newx[[xname]]` to
preserve column class. Categorical detection extended to cover
`is.factor()` and `is.character()` in addition to the cardinality check.
* Add guards to `gg_partial_rfsrc()`: all-NA `xval` after NA removal now
emits a warning and skips the variable; all-NA grouping variable (`xvar2`)
calls `stop()`; `n_eval` and `cat_limit` are validated as single integers
>= 2 near function entry.
* Fix cyclomatic complexity across `gg_partial_rfsrc.R`: refactored into
eight top-level unexported helpers (`validate_scalar_int`,
`validate_partial_args`, `snap_partial_time`, `make_eval_grid`,
`call_partial_rfsrc`, `partial_one_var`, `partial_no_group`,
`partial_with_group`, `split_partial_result`); all functions now score
below the `cyclocomp_linter` limit of 20.
* Fix `@param partial.time` documentation: "see the section above" corrected
to "see the section below".
* Replace deprecated `tidyr::gather()` with `tidyr::pivot_longer()` in
`plot.gg_vimp()` and `plot.gg_partialpro()`.
* Add `gg_survival.rfsrc`, `gg_survival.default`, `plot.gg_partial`,
`plot.gg_partial_rfsrc`, and `plot.gg_partialpro` to `NAMESPACE`; add
corresponding `@rdname` / `@export` roxygen tags.
* Update tests: add `expect_s3_class()` checks for all new classes; add
`plot()` smoke tests for `gg_partial`, `gg_partial_rfsrc`, `gg_partialpro`;
add `gg_survival.rfsrc` tests for KM extraction, `by` stratification, and
error on non-survival forest.
* Add `plot.gg_partial`, `plot.gg_partial_rfsrc`, and `plot.gg_partialpro`
to `_pkgdown.yml` reference index.

ggRandomForests v2.7.0
=====================
Expand Down
4 changes: 3 additions & 1 deletion R/gg_partial.R
Original file line number Diff line number Diff line change
Expand Up @@ -111,5 +111,7 @@ gg_partial <- function(part_dta,
}
}

return(list(continuous = continuous, categorical = categorical))
result <- list(continuous = continuous, categorical = categorical)
class(result) <- "gg_partial"
return(result)
}
Loading
Loading