topepo / caret

caret (Classification And Regression Training) R package that contains misc functions for training and plotting classification and regression models
http://topepo.github.io/caret/index.html
1.61k stars 632 forks source link

example("summary.bagEarth", run.dontrun = TRUE): Error in model.frame.default(formula = ~., data = list(subY = list(c(10.3,: invalid type (list) for variable 'subY' #1286

Open HenrikBengtsson opened 2 years ago

HenrikBengtsson commented 2 years ago

Reproducible examples

$ R --vanilla

R version 4.2.0 (2022-04-22) -- "Vigorous Calisthenics"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
...

> example("summary.bagEarth", package = "caret", run.dontrun = TRUE)
Loading required package: ggplot2
Loading required package: lattice

smmr.E> data(trees)

smmr.E> set.seed(9655)

smmr.E> fit <- bagEarth(trees[,-3], trees[3])
Error in model.frame.default(formula = ~., data = list(subY = list(c(10.3,  : 
  invalid type (list) for variable 'subY'
> traceback()
17: model.frame.default(formula = ~., data = structure(list(subY = list(
        c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 
        24.2, 21, 21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 
        34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 51, 
        77), c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 
        19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 
        24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 
        51, 77), c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 
        22.6, 19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 
        25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 
        51.5, 51, 77), c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 
        18.2, 22.6, 19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 33.8, 
        27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 
        58.3, 51.5, 51, 77), c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 
        15.6, 18.2, 22.6, 19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 
        33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 
        55.7, 58.3, 51.5, 51, 77), c(10.3, 10.3, 10.2, 16.4, 18.8, 
        19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 21, 21.4, 21.3, 19.1, 
        22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 
        55.4, 55.7, 58.3, 51.5, 51, 77), c(10.3, 10.3, 10.2, 16.4, 
        18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 21, 21.4, 21.3, 
        19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 
        42.6, 55.4, 55.7, 58.3, 51.5, 51, 77), c(10.3, 10.3, 10.2, 
        16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 21, 21.4, 
        21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 
        38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 51, 77), c(10.3, 10.3, 
        10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 21, 
        21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 
        36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 51, 77), c(10.3, 
        10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 
        21, 21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 
        31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 51, 77), 
        c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 
        24.2, 21, 21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 
        34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 51, 
        77), c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 
        19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 
        24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 
        51, 77), c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 
        22.6, 19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 
        25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 
        51.5, 51, 77), c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 
        18.2, 22.6, 19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 33.8, 
        27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 
        58.3, 51.5, 51, 77), c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 
        15.6, 18.2, 22.6, 19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 
        33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 
        55.7, 58.3, 51.5, 51, 77), c(10.3, 10.3, 10.2, 16.4, 18.8, 
        19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 21, 21.4, 21.3, 19.1, 
        22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 
        55.4, 55.7, 58.3, 51.5, 51, 77), c(10.3, 10.3, 10.2, 16.4, 
        18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 21, 21.4, 21.3, 
        19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 
        42.6, 55.4, 55.7, 58.3, 51.5, 51, 77), c(10.3, 10.3, 10.2, 
        16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 21, 21.4, 
        21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 
        38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 51, 77), c(10.3, 10.3, 
        10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 21, 
        21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 
        36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 51, 77), c(10.3, 
        10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 
        21, 21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 
        31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 51, 77), 
        c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 
        24.2, 21, 21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 
        34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 51, 
        77), c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 
        19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 
        24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 
        51, 77), c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 
        22.6, 19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 
        25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 
        51.5, 51, 77), c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 
        18.2, 22.6, 19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 33.8, 
        27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 
        58.3, 51.5, 51, 77), c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 
        15.6, 18.2, 22.6, 19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 
        33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 
        55.7, 58.3, 51.5, 51, 77), c(10.3, 10.3, 10.2, 16.4, 18.8, 
        19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 21, 21.4, 21.3, 19.1, 
        22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 
        55.4, 55.7, 58.3, 51.5, 51, 77), c(10.3, 10.3, 10.2, 16.4, 
        18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 21, 21.4, 21.3, 
        19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 
        42.6, 55.4, 55.7, 58.3, 51.5, 51, 77), c(10.3, 10.3, 10.2, 
        16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 21, 21.4, 
        21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 
        38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 51, 77), c(10.3, 10.3, 
        10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 21, 
        21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 
        36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 51, 77), c(10.3, 
        10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 
        21, 21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 
        31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 51, 77), 
        c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 
        24.2, 21, 21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 
        34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 51, 
        77), c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 
        19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 
        24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 
        51, 77), c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 
        22.6, 19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 
        25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 
        51.5, 51, 77), c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 
        18.2, 22.6, 19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 33.8, 
        27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 
        58.3, 51.5, 51, 77), c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 
        15.6, 18.2, 22.6, 19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 
        33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 
        55.7, 58.3, 51.5, 51, 77), c(10.3, 10.3, 10.2, 16.4, 18.8, 
        19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 21, 21.4, 21.3, 19.1, 
        22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 
        55.4, 55.7, 58.3, 51.5, 51, 77), c(10.3, 10.3, 10.2, 16.4, 
        18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 21, 21.4, 21.3, 
        19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 
        42.6, 55.4, 55.7, 58.3, 51.5, 51, 77), c(10.3, 10.3, 10.2, 
        16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 21, 21.4, 
        21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 
        38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 51, 77), c(10.3, 10.3, 
        10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 21, 
        21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 
        36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 51, 77), c(10.3, 
        10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 
        21, 21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 
        31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 51, 77), 
        c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 
        24.2, 21, 21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 
        34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 51, 
        77), c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 
        19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 
        24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 
        51, 77), c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 
        22.6, 19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 
        25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 
        51.5, 51, 77), c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 
        18.2, 22.6, 19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 33.8, 
        27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 
        58.3, 51.5, 51, 77), c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 
        15.6, 18.2, 22.6, 19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 
        33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 
        55.7, 58.3, 51.5, 51, 77), c(10.3, 10.3, 10.2, 16.4, 18.8, 
        19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 21, 21.4, 21.3, 19.1, 
        22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 
        55.4, 55.7, 58.3, 51.5, 51, 77), c(10.3, 10.3, 10.2, 16.4, 
        18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 21, 21.4, 21.3, 
        19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 
        42.6, 55.4, 55.7, 58.3, 51.5, 51, 77), c(10.3, 10.3, 10.2, 
        16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 21, 21.4, 
        21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 
        38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 51, 77), c(10.3, 10.3, 
        10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 21, 
        21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 
        36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 51, 77), c(10.3, 
        10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 
        21, 21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 
        31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 51, 77))), class = "data.frame", row.names = c(NA, 
    -50L)), na.action = function (object, ...) 
    object)
16: model.frame(formula = ~., data = structure(list(subY = list(c(10.3, 
    10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 21, 
    21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 
    38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 51, 77), c(10.3, 10.3, 10.2, 
    16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 21, 21.4, 21.3, 
    19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 
    55.4, 55.7, 58.3, 51.5, 51, 77), c(10.3, 10.3, 10.2, 16.4, 18.8, 
    19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 
    33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 
    58.3, 51.5, 51, 77), c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 
    18.2, 22.6, 19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 
    25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 
    51, 77), c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 
    19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 
    34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 51, 77), 
        c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 
        24.2, 21, 21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 
        34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 51, 
        77), c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 
        19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 
        24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 
        51, 77), c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 
        22.6, 19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 
        25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 
        51.5, 51, 77), c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 
        18.2, 22.6, 19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 33.8, 
        27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 
        58.3, 51.5, 51, 77), c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 
        15.6, 18.2, 22.6, 19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 
        33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 
        55.7, 58.3, 51.5, 51, 77), c(10.3, 10.3, 10.2, 16.4, 18.8, 
        19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 21, 21.4, 21.3, 19.1, 
        22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 
        55.4, 55.7, 58.3, 51.5, 51, 77), c(10.3, 10.3, 10.2, 16.4, 
        18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 21, 21.4, 21.3, 
        19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 
        42.6, 55.4, 55.7, 58.3, 51.5, 51, 77), c(10.3, 10.3, 10.2, 
        16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 21, 21.4, 
        21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 
        38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 51, 77), c(10.3, 10.3, 
        10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 21, 
        21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 
        36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 51, 77), c(10.3, 
        10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 
        21, 21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 
        31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 51, 77), 
        c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 
        24.2, 21, 21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 
        34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 51, 
        77), c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 
        19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 
        24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 
        51, 77), c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 
        22.6, 19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 
        25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 
        51.5, 51, 77), c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 
        18.2, 22.6, 19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 33.8, 
        27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 
        58.3, 51.5, 51, 77), c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 
        15.6, 18.2, 22.6, 19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 
        33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 
        55.7, 58.3, 51.5, 51, 77), c(10.3, 10.3, 10.2, 16.4, 18.8, 
        19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 21, 21.4, 21.3, 19.1, 
        22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 
        55.4, 55.7, 58.3, 51.5, 51, 77), c(10.3, 10.3, 10.2, 16.4, 
        18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 21, 21.4, 21.3, 
        19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 
        42.6, 55.4, 55.7, 58.3, 51.5, 51, 77), c(10.3, 10.3, 10.2, 
        16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 21, 21.4, 
        21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 
        38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 51, 77), c(10.3, 10.3, 
        10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 21, 
        21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 
        36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 51, 77), c(10.3, 
        10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 
        21, 21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 
        31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 51, 77), 
        c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 
        24.2, 21, 21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 
        34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 51, 
        77), c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 
        19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 
        24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 
        51, 77), c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 
        22.6, 19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 
        25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 
        51.5, 51, 77), c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 
        18.2, 22.6, 19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 33.8, 
        27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 
        58.3, 51.5, 51, 77), c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 
        15.6, 18.2, 22.6, 19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 
        33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 
        55.7, 58.3, 51.5, 51, 77), c(10.3, 10.3, 10.2, 16.4, 18.8, 
        19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 21, 21.4, 21.3, 19.1, 
        22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 
        55.4, 55.7, 58.3, 51.5, 51, 77), c(10.3, 10.3, 10.2, 16.4, 
        18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 21, 21.4, 21.3, 
        19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 
        42.6, 55.4, 55.7, 58.3, 51.5, 51, 77), c(10.3, 10.3, 10.2, 
        16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 21, 21.4, 
        21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 
        38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 51, 77), c(10.3, 10.3, 
        10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 21, 
        21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 
        36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 51, 77), c(10.3, 
        10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 
        21, 21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 
        31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 51, 77), 
        c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 
        24.2, 21, 21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 
        34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 51, 
        77), c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 
        19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 
        24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 
        51, 77), c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 
        22.6, 19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 
        25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 
        51.5, 51, 77), c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 
        18.2, 22.6, 19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 33.8, 
        27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 
        58.3, 51.5, 51, 77), c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 
        15.6, 18.2, 22.6, 19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 
        33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 
        55.7, 58.3, 51.5, 51, 77), c(10.3, 10.3, 10.2, 16.4, 18.8, 
        19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 21, 21.4, 21.3, 19.1, 
        22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 
        55.4, 55.7, 58.3, 51.5, 51, 77), c(10.3, 10.3, 10.2, 16.4, 
        18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 21, 21.4, 21.3, 
        19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 
        42.6, 55.4, 55.7, 58.3, 51.5, 51, 77), c(10.3, 10.3, 10.2, 
        16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 21, 21.4, 
        21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 
        38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 51, 77), c(10.3, 10.3, 
        10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 21, 
        21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 
        36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 51, 77), c(10.3, 
        10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 24.2, 
        21, 21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 34.5, 
        31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 51, 77), 
        c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 19.9, 
        24.2, 21, 21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 24.9, 
        34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 51, 
        77), c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 22.6, 
        19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 25.7, 
        24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 51.5, 
        51, 77), c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 18.2, 
        22.6, 19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 33.8, 27.4, 
        25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 58.3, 
        51.5, 51, 77), c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 15.6, 
        18.2, 22.6, 19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 33.8, 
        27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 55.7, 
        58.3, 51.5, 51, 77), c(10.3, 10.3, 10.2, 16.4, 18.8, 19.7, 
        15.6, 18.2, 22.6, 19.9, 24.2, 21, 21.4, 21.3, 19.1, 22.2, 
        33.8, 27.4, 25.7, 24.9, 34.5, 31.7, 36.3, 38.3, 42.6, 55.4, 
        55.7, 58.3, 51.5, 51, 77))), class = "data.frame", row.names = c(NA, 
    -50L)), na.action = function (object, ...) 
    object)
15: eval(mf, envir = env)
14: eval(mf, envir = env)
13: expand.arg.modvars(x, env, trace, is.y.arg, name)
12: expand.arg(y, env, trace = 0, is.y.arg = TRUE, name = trunc.deparse(substitute(y)))
11: earth.default(x = subX, y = subY, weights = subW, ...)
10: earth::earth(x = subX, y = subY, weights = subW, ...)
9: FUN(X[[i]], ...)
8: lapply(btSamples, foo, x = x, y = y, w = weights, ...)
7: bagEarth.default(trees[, -3], trees[3])
6: bagEarth(trees[, -3], trees[3]) at Rex7c6368095369#12
5: eval(ei, envir)
4: eval(ei, envir)
3: withVisible(eval(ei, envir))
2: source(tf, local, echo = echo, prompt.echo = paste0(prompt.prefix, 
       getOption("prompt")), continue.echo = paste0(prompt.prefix, 
       getOption("continue")), verbose = verbose, max.deparse.length = Inf, 
       encoding = "UTF-8", skip.echo = skips, keep.source = TRUE)
1: example("summary.bagEarth", package = "caret", run.dontrun = TRUE)

Session info

> sessionInfo()
R version 4.2.0 (2022-04-22)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.4 LTS

Matrix products: default
BLAS:   /home/hb/shared/software/CBI/R-4.2.0-gcc9/lib/R/lib/libRblas.so
LAPACK: /home/hb/shared/software/CBI/R-4.2.0-gcc9/lib/R/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] caret_6.0-92    lattice_0.20-45 ggplot2_3.3.5  

loaded via a namespace (and not attached):
 [1] tidyselect_1.1.2     purrr_0.3.4          reshape2_1.4.4      
 [4] listenv_0.8.0        splines_4.2.0        colorspace_2.0-3    
 [7] vctrs_0.4.1          generics_0.1.2       stats4_4.2.0        
[10] utf8_1.2.2           survival_3.3-1       prodlim_2019.11.13  
[13] rlang_1.0.2          ModelMetrics_1.2.2.2 pillar_1.7.0        
[16] glue_1.6.2           withr_2.5.0          DBI_1.1.2           
[19] plotmo_3.6.1         foreach_1.5.2        lifecycle_1.0.1     
[22] plyr_1.8.7           lava_1.6.10          stringr_1.4.0       
[25] timeDate_3043.102    munsell_0.5.0        gtable_0.3.0        
[28] future_1.25.0        recipes_0.2.0        codetools_0.2-18    
[31] parallel_4.2.0       class_7.3-20         fansi_1.0.3         
[34] Rcpp_1.0.8.3         scales_1.2.0         plotrix_3.8-2       
[37] ipred_0.9-12         parallelly_1.31.1    TeachingDemos_2.12  
[40] digest_0.6.29        stringi_1.7.6        dplyr_1.0.8         
[43] grid_4.2.0           hardhat_0.2.0        cli_3.3.0           
[46] tools_4.2.0          magrittr_2.0.3       tibble_3.1.6        
[49] Formula_1.2-4        crayon_1.5.1         future.apply_1.9.0  
[52] pkgconfig_2.0.3      ellipsis_0.3.2       MASS_7.3-57         
[55] Matrix_1.4-1         data.table_1.14.2    pROC_1.18.0         
[58] lubridate_1.8.0      gower_1.0.0          assertthat_0.2.1    
[61] iterators_1.0.14     earth_5.3.1          R6_2.5.1            
[64] globals_0.14.0       rpart_4.1.16         nnet_7.3-17         
[67] nlme_3.1-157         compiler_4.2.0      
> 

FWIW, this was not the case on 2021-09-26 when I last checked, which means the problem was most likely introduced since then, either in caret or one of the dependencies used in this example.

HenrikBengtsson commented 2 years ago

Seems specific to R (>= 4.2.0), because it works in R 4.1.3.

> sessionInfo()
R version 4.1.3 (2022-03-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.4 LTS

Matrix products: default
BLAS:   /home/hb/shared/software/CBI/R-4.1.3/lib/R/lib/libRblas.so
LAPACK: /home/hb/shared/software/CBI/R-4.1.3/lib/R/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] caret_6.0-92    lattice_0.20-45 ggplot2_3.3.5  

loaded via a namespace (and not attached):
 [1] tidyselect_1.1.2     purrr_0.3.4          reshape2_1.4.4      
 [4] listenv_0.8.0        splines_4.1.3        colorspace_2.0-3    
 [7] vctrs_0.4.1          generics_0.1.2       stats4_4.1.3        
[10] utf8_1.2.2           survival_3.3-1       prodlim_2019.11.13  
[13] rlang_1.0.2          ModelMetrics_1.2.2.2 pillar_1.7.0        
[16] glue_1.6.2           withr_2.5.0          DBI_1.1.2           
[19] plotmo_3.6.1         foreach_1.5.2        lifecycle_1.0.1     
[22] plyr_1.8.7           lava_1.6.10          stringr_1.4.0       
[25] timeDate_3043.102    munsell_0.5.0        gtable_0.3.0        
[28] future_1.25.0        recipes_0.2.0        codetools_0.2-18    
[31] parallel_4.1.3       class_7.3-20         fansi_1.0.3         
[34] Rcpp_1.0.8.3         scales_1.2.0         plotrix_3.8-2       
[37] ipred_0.9-12         parallelly_1.31.1    TeachingDemos_2.12  
[40] digest_0.6.29        stringi_1.7.6        dplyr_1.0.8         
[43] grid_4.1.3           hardhat_0.2.0        cli_3.3.0           
[46] tools_4.1.3          magrittr_2.0.3       tibble_3.1.6        
[49] Formula_1.2-4        crayon_1.5.1         future.apply_1.9.0  
[52] pkgconfig_2.0.3      ellipsis_0.3.2       MASS_7.3-57         
[55] Matrix_1.4-1         data.table_1.14.2    pROC_1.18.0         
[58] lubridate_1.8.0      gower_1.0.0          assertthat_0.2.1    
[61] iterators_1.0.14     earth_5.3.1          R6_2.5.1            
[64] globals_0.14.0       rpart_4.1.16         nnet_7.3-17         
[67] nlme_3.1-157         compiler_4.1.3