Return the names of smooth terms from a model object.
Arguments
- x
A (gam) model.
- flatten
Logical, if
TRUE
, the values are returned as character vector, not as list. Duplicated values are removed.
Examples
if (require("mgcv")) {
data(iris)
model <- gam(Petal.Length ~ Petal.Width + s(Sepal.Length), data = iris)
find_smooth(model)
}
#> Loading required package: mgcv
#> Loading required package: nlme
#>
#> Attaching package: ‘nlme’
#> The following object is masked from ‘package:lme4’:
#>
#> lmList
#> This is mgcv 1.8-42. For overview type 'help("mgcv-package")'.
#>
#> Attaching package: ‘mgcv’
#> The following objects are masked from ‘package:brms’:
#>
#> s, t2
#> $smooth_terms
#> [1] "s(Sepal.Length)"
#>