Super Learning with Flexible Formulas
Overview
A functional programming based implementation of the super learner algorithm with an emphasis on supporting the use of formulas to specify learners. This approach offers several improvements compared to past implementations including the ability to easily use random-effects specified in formulas (like y ~ (age | strata) + ...) and construction of new learners is as simple as writing and passing a new function. The super learner algorithm was originally described in van der Laan et al. (2007) https://biostats.bepress.com/ucbbiostat/paper222/.
- Initial CRAN submission.
From NEWS.md in the release
Install
Health
ERRORexamplesr-devel-linux-x86_64-debian-gcc, r-devel-linux-x86_64-fedora-clang, r-devel-linux-x86_64-fedora-gcc, r-release-linux-x86_64
r-devel-linux-x86_64-fedora-clang, r-devel-linux-x86_64-fedora-gcc
Running examples in ‘nadir-Ex.R’ failed
The error most likely occurred in:
> ### Name: lnr_glmer
> ### Title: Generalized Linear Mixed-Effects ('lme4::glmer') Learner
> ### Aliases: lnr_glmer
>
> ### ** Examples
>
> # random intercepts for each level of cyl column:
> suppressMessages({
+ # singular fit, but that's ok if all you need is prediction:
+ lnr_glmer(mtcars, mpg ~ (1|cyl) + disp + wt, family = Gamma)(mtcars)
+ })
Error in model.frame.default(data = data, weights = weights, drop.unused.levels = TRUE, :
invalid type (closure) for variable '(weights)'
Calls: suppressMessages ... mkFormula -> eval -> eval -> <Anonymous> -> model.frame.default
Execution haltedr-devel-linux-x86_64-debian-gcc
Running examples in ‘nadir-Ex.R’ failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: lnr_glmer
> ### Title: Generalized Linear Mixed-Effects ('lme4::glmer') Learner
> ### Aliases: lnr_glmer
>
> ### ** Examples
>
> # random intercepts for each level of cyl column:
> suppressMessages({
+ # singular fit, but that's ok if all you need is prediction:
+ lnr_glmer(mtcars, mpg ~ (1|cyl) + disp + wt, family = Gamma)(mtcars)
+ })
Error in model.frame.default(data = data, weights = weights, drop.unused.levels = TRUE, :
invalid type (closure) for variable '(weights)'
Calls: suppressMessages ... mkFormula -> eval -> eval -> <Anonymous> -> model.frame.default
Execution halted
Examples with CPU (user + system) or elapsed time > 5s
user system elapsed
cv_super_learner 6.211 0.167 8.81r-release-linux-x86_64
Running examples in ‘nadir-Ex.R’ failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: lnr_glmer
> ### Title: Generalized Linear Mixed-Effects ('lme4::glmer') Learner
> ### Aliases: lnr_glmer
>
> ### ** Examples
>
> # random intercepts for each level of cyl column:
> suppressMessages({
+ # singular fit, but that's ok if all you need is prediction:
+ lnr_glmer(mtcars, mpg ~ (1|cyl) + disp + wt, family = Gamma)(mtcars)
+ })
Error in model.frame.default(data = data, weights = weights, drop.unused.levels = TRUE, :
invalid type (closure) for variable '(weights)'
Calls: suppressMessages ... mkFormula -> eval -> eval -> <Anonymous> -> model.frame.default
Execution halted
Examples with CPU (user + system) or elapsed time > 5s
user system elapsed
cv_super_learner 10.699 0.126 12.816
compare_learners 4.655 0.040 7.338
cv_origami_schema 4.362 0.048 6.039ERRORtestsr-devel-linux-x86_64-debian-gcc, r-devel-linux-x86_64-fedora-clang, r-devel-linux-x86_64-fedora-gcc, r-release-linux-x86_64
r-devel-linux-x86_64-debian-gcc
Running ‘testthat.R’ [39s/51s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
> # This file is part of the standard setup for testthat.
> # It is recommended that you do not modify it.
> #
> # Where should you do additional test configuration?
> # Learn more about the roles of various files in:
> # * https://r-pkgs.org/testing-design.html#sec-tests-files-overview
> # * https://testthat.r-lib.org/articles/special-files.html
>
> library(testthat)
> library(nadir)
>
> test_check("nadir")
Saving _problems/test-continuous-learners-31.R
Saving _problems/test-continuous-learners-68.R
[ FAIL 2 | WARN 0 | SKIP 0 | PASS 32 ]
══ Failed tests ════════════════════════════════════════════════════════════════
── Error ('test-continuous-learners.R:30:3'): all continuous learners can be trained and predict on mtcars ──
Error in `model.frame.default(data = data, weights = weights, drop.unused.levels = TRUE, formula = mpg ~ (1 + cyl) + hp)`: inva
...[truncated]...
└─lme4:::mkFormula(...)
7. │ └─base::eval(mf, parent_env)
8. │ └─base::eval(mf, parent_env)
9. ├─stats::model.frame(...)
10. └─stats::model.frame.default(...)
── Error ('test-continuous-learners.R:67:3'): all binary learners can be trained and predict on mtcars ──
Error in `model.frame.default(data = data, weights = weights, drop.unused.levels = TRUE, formula = am ~ (1 + cyl) + hp)`: invalid type (closure) for variable '(weights)'
Backtrace:
▆
1. └─nadir::lnr_glmer(...) at test-continuous-learners.R:67:3
2. ├─lme4::glmer(...)
3. │ └─base::eval(mc, parent.frame(1L))
4. │ └─base::eval(mc, parent.frame(1L))
5. ├─lme4::glFormula(...)
6. │ └─lme4:::mkFormula(...)
7. │ └─base::eval(mf, parent_env)
8. │ └─base::eval(mf, parent_env)
9. ├─stats::model.frame(...)
10. └─stats::model.frame.default(...)
[ FAIL 2 | WARN 0 | SKIP 0 | PASS 32 ]
Error:
! Test failures.
Execution haltedr-devel-linux-x86_64-fedora-clang
Running ‘testthat.R’ [40s/116s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
> # This file is part of the standard setup for testthat.
> # It is recommended that you do not modify it.
> #
> # Where should you do additional test configuration?
> # Learn more about the roles of various files in:
> # * https://r-pkgs.org/testing-design.html#sec-tests-files-overview
> # * https://testthat.r-lib.org/articles/special-files.html
>
> library(testthat)
> library(nadir)
>
> test_check("nadir")
Saving _problems/test-continuous-learners-31.R
Saving _problems/test-continuous-learners-68.R
[ FAIL 2 | WARN 0 | SKIP 0 | PASS 32 ]
══ Failed tests ════════════════════════════════════════════════════════════════
── Error ('test-continuous-learners.R:30:3'): all continuous learners can be trained and predict on mtcars ──
Error in `model.frame.default(data = data, weights = weights, drop.unused.levels = TRUE, formula = mpg ~ (1 + cyl) + hp)`: inv
...[truncated]...
└─lme4:::mkFormula(...)
7. │ └─base::eval(mf, parent_env)
8. │ └─base::eval(mf, parent_env)
9. ├─stats::model.frame(...)
10. └─stats::model.frame.default(...)
── Error ('test-continuous-learners.R:67:3'): all binary learners can be trained and predict on mtcars ──
Error in `model.frame.default(data = data, weights = weights, drop.unused.levels = TRUE, formula = am ~ (1 + cyl) + hp)`: invalid type (closure) for variable '(weights)'
Backtrace:
▆
1. └─nadir::lnr_glmer(...) at test-continuous-learners.R:67:3
2. ├─lme4::glmer(...)
3. │ └─base::eval(mc, parent.frame(1L))
4. │ └─base::eval(mc, parent.frame(1L))
5. ├─lme4::glFormula(...)
6. │ └─lme4:::mkFormula(...)
7. │ └─base::eval(mf, parent_env)
8. │ └─base::eval(mf, parent_env)
9. ├─stats::model.frame(...)
10. └─stats::model.frame.default(...)
[ FAIL 2 | WARN 0 | SKIP 0 | PASS 32 ]
Error:
! Test failures.
Execution haltedr-devel-linux-x86_64-fedora-gcc
Running ‘testthat.R’ [40s/99s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
> # This file is part of the standard setup for testthat.
> # It is recommended that you do not modify it.
> #
> # Where should you do additional test configuration?
> # Learn more about the roles of various files in:
> # * https://r-pkgs.org/testing-design.html#sec-tests-files-overview
> # * https://testthat.r-lib.org/articles/special-files.html
>
> library(testthat)
> library(nadir)
>
> test_check("nadir")
Saving _problems/test-continuous-learners-31.R
Saving _problems/test-continuous-learners-68.R
[ FAIL 2 | WARN 0 | SKIP 0 | PASS 32 ]
══ Failed tests ════════════════════════════════════════════════════════════════
── Error ('test-continuous-learners.R:30:3'): all continuous learners can be trained and predict on mtcars ──
Error in `model.frame.default(data = data, weights = weights, drop.unused.levels = TRUE, formula = mpg ~ (1 + cyl) + hp)`: inva
...[truncated]...
└─lme4:::mkFormula(...)
7. │ └─base::eval(mf, parent_env)
8. │ └─base::eval(mf, parent_env)
9. ├─stats::model.frame(...)
10. └─stats::model.frame.default(...)
── Error ('test-continuous-learners.R:67:3'): all binary learners can be trained and predict on mtcars ──
Error in `model.frame.default(data = data, weights = weights, drop.unused.levels = TRUE, formula = am ~ (1 + cyl) + hp)`: invalid type (closure) for variable '(weights)'
Backtrace:
▆
1. └─nadir::lnr_glmer(...) at test-continuous-learners.R:67:3
2. ├─lme4::glmer(...)
3. │ └─base::eval(mc, parent.frame(1L))
4. │ └─base::eval(mc, parent.frame(1L))
5. ├─lme4::glFormula(...)
6. │ └─lme4:::mkFormula(...)
7. │ └─base::eval(mf, parent_env)
8. │ └─base::eval(mf, parent_env)
9. ├─stats::model.frame(...)
10. └─stats::model.frame.default(...)
[ FAIL 2 | WARN 0 | SKIP 0 | PASS 32 ]
Error:
! Test failures.
Execution haltedr-release-linux-x86_64
Running ‘testthat.R’ [55s/62s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
> # This file is part of the standard setup for testthat.
> # It is recommended that you do not modify it.
> #
> # Where should you do additional test configuration?
> # Learn more about the roles of various files in:
> # * https://r-pkgs.org/testing-design.html#sec-tests-files-overview
> # * https://testthat.r-lib.org/articles/special-files.html
>
> library(testthat)
> library(nadir)
>
> test_check("nadir")
Saving _problems/test-continuous-learners-31.R
Saving _problems/test-continuous-learners-68.R
[ FAIL 2 | WARN 0 | SKIP 0 | PASS 32 ]
══ Failed tests ════════════════════════════════════════════════════════════════
── Error ('test-continuous-learners.R:30:3'): all continuous learners can be trained and predict on mtcars ──
Error in `model.frame.default(data = data, weights = weights, drop.unused.levels = TRUE, formula = mpg ~ (1 + cyl) + hp)`: inva
...[truncated]...
└─lme4:::mkFormula(...)
7. │ └─base::eval(mf, parent_env)
8. │ └─base::eval(mf, parent_env)
9. ├─stats::model.frame(...)
10. └─stats::model.frame.default(...)
── Error ('test-continuous-learners.R:67:3'): all binary learners can be trained and predict on mtcars ──
Error in `model.frame.default(data = data, weights = weights, drop.unused.levels = TRUE, formula = am ~ (1 + cyl) + hp)`: invalid type (closure) for variable '(weights)'
Backtrace:
▆
1. └─nadir::lnr_glmer(...) at test-continuous-learners.R:67:3
2. ├─lme4::glmer(...)
3. │ └─base::eval(mc, parent.frame(1L))
4. │ └─base::eval(mc, parent.frame(1L))
5. ├─lme4::glFormula(...)
6. │ └─lme4:::mkFormula(...)
7. │ └─base::eval(mf, parent_env)
8. │ └─base::eval(mf, parent_env)
9. ├─stats::model.frame(...)
10. └─stats::model.frame.default(...)
[ FAIL 2 | WARN 0 | SKIP 0 | PASS 32 ]
Error:
! Test failures.
Execution halted- ERROR9 OK, 4 ERRORNow
- ERROR11 OK, 2 ERROR2026-10-24
- OK13 OK2026-08-05
- NOTE12 OK, 1 NOTE2026-08-01
- OK14 OK2026-03-10
Documentation
The repository also keeps web-only articles.
- Help pages
- 58 (10 internal)includes a package overview page
- Examples that run
- 100%44 run in a plain check (2 of them under a condition)
- Exported functions with examples
- 95%
- Documented parameters
- 100%
- Return-value docs
- 98%
- Help pages citing references
- 0%
- Basic Examples HTML
Downloads
Repository
- PRs merged (all time)
- 100%
- Median days to close, 50 most recently updated closed issues
- 137
- Median days to close, 50 most recently updated closed PRs
- 0
Stars over time
Forks over time
Issues over time
PRs over time
Commits over time
Commit identities over time
10 development-tooling and community-health practices detected across 6 families in the upstream repository
Checks run against github.com/ctesta01/nadir on 2026-10-21.
The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel
GitHub Pages site last deployed 2026-10-10
pkgdown site last built 2025-03-01, before release 0.0.1 (2026-02-20)
Show all practicesHide 2 practices
Dependencies
Installing nadir adds 54 packages (31 with compiled code, 48 MB of source tarballs). Heaviest: stringi 11 MB, data.table 5.7 MB, lme4 4.3 MB.
CRAN will archive these unless their check problems are fixed by the date shown. This package needs each one to install.
- hal9001fix by Oct 29
Code & Tests
People & History
- RR 4.6.0 released · 2026-04-24
- 0.0.1Latest2026-02-20 · current release
- RR 4.5.0 released · 2025-04-11
Package metadata
- First published
- 2026-02-20
- Total releases
- 1 / 1 yrs
- License
- MIT + file LICENSE OSI
- Minimum R
- ≥ 4.2.0
- Download size
- 1.4 MB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("nadir")This package has no citation file, so citation() returns this entry built from DESCRIPTION.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-25, which the citation names so these numbers can be found later. More on citing and the projects behind them.