Skip to content

Commit a2af139

Browse files
committed
protect against $method partial match
1 parent fd17f08 commit a2af139

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

R/geom-smooth.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ geom_smooth <- function(mapping = NULL, data = NULL,
102102
...
103103
)
104104
if (identical(stat, "smooth")) {
105-
params$method <- method
105+
params[["method"]] <- method
106106
params$formula <- formula
107107
}
108108

R/stat-smooth.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ StatSmooth <- ggproto("StatSmooth", Stat,
9595
setup_params = function(data, params) {
9696
params$flipped_aes <- has_flipped_aes(data, params, ambiguous = TRUE)
9797
msg <- character()
98-
method <- params$method
98+
method <- params[["method"]]
9999
if (is.null(method) || identical(method, "auto")) {
100100
# Use loess for small datasets, gam with a cubic regression basis for
101101
# larger. Based on size of the _largest_ group to avoid bad memory
@@ -144,14 +144,14 @@ StatSmooth <- ggproto("StatSmooth", Stat,
144144
}
145145
# If gam and gam's method is not specified by the user then use REML
146146
if (identical(method, gam_method())) {
147-
params$method.args$method <- params$method.args$method %||% "REML"
147+
params$method.args[["method"]] <- params$method.args[["method"]] %||% "REML"
148148
}
149149

150150
if (length(msg) > 0) {
151151
cli::cli_inform("{.fn geom_smooth} using {msg}")
152152
}
153153

154-
params$method <- method
154+
params[["method"]] <- method
155155
params
156156
},
157157

0 commit comments

Comments
 (0)