@@ -111,7 +111,7 @@ StatSmooth <- ggproto("StatSmooth", Stat,
111
111
}
112
112
113
113
if (is.null(params $ formula )) {
114
- if (identical(method , " gam" ) && is_installed( " mgcv " ) ) {
114
+ if (identical(method , " gam" )) {
115
115
params $ formula <- y ~ s(x , bs = " cs" )
116
116
} else {
117
117
params $ formula <- y ~ x
@@ -133,15 +133,7 @@ StatSmooth <- ggproto("StatSmooth", Stat,
133
133
}
134
134
# If gam and gam's method is not specified by the user then use REML
135
135
if (identical(method , gam_method())) {
136
- if (identical(method , stats :: lm )) {
137
- cli :: cli_warn(c(
138
- " The {.pkg mgcv} package must be installed to use \\
139
- {.code method = \" gam\" }." ,
140
- " Falling back to {.code method = \" lm\" }."
141
- ))
142
- } else {
143
- params $ method.args $ method <- params $ method.args $ method %|| % " REML"
144
- }
136
+ params $ method.args $ method <- params $ method.args $ method %|| % " REML"
145
137
}
146
138
147
139
if (length(msg ) > 0 ) {
@@ -212,10 +204,4 @@ StatSmooth <- ggproto("StatSmooth", Stat,
212
204
)
213
205
214
206
# This function exists to silence an undeclared import warning
215
- gam_method <- function () {
216
- if (is_installed(" mgcv" )) {
217
- mgcv :: gam
218
- } else {
219
- stats :: lm
220
- }
221
- }
207
+ gam_method <- function () mgcv :: gam
0 commit comments