From ccceaf22aae088f2b59eeb19604043cf148b6872 Mon Sep 17 00:00:00 2001 From: Claus Wilke Date: Fri, 1 Jun 2018 14:00:33 -0500 Subject: [PATCH] Improve stat_smooth documentation. --- R/stat-smooth.r | 6 +++++- man/aes.Rd | 2 +- man/geom_smooth.Rd | 8 ++++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/R/stat-smooth.r b/R/stat-smooth.r index 36876dfc82..1f51803abb 100644 --- a/R/stat-smooth.r +++ b/R/stat-smooth.r @@ -4,9 +4,13 @@ #' For `method = "auto"` the smoothing method is chosen based on the #' size of the largest group (across all panels). [loess()] is #' used for less than 1,000 observations; otherwise [mgcv::gam()] is -#' used with `formula = y ~ mgcv::s(x, bs = "cs")`. Somewhat anecdotally, +#' used with `formula = y ~ s(x, bs = "cs")`. Somewhat anecdotally, #' `loess` gives a better appearance, but is O(n^2) in memory, so does #' not work for larger datasets. +#' +#' If you have fewer than 1,000 observations but want to use the same `gam` +#' model that `method = "auto"` would use then set +#' `method = "gam", formula = y ~ s(x, bs = "cs")`. #' @param formula Formula to use in smoothing function, eg. `y ~ x`, #' `y ~ poly(x, 2)`, `y ~ log(x)` #' @param se Display confidence interval around smooth? (TRUE by default, see diff --git a/man/aes.Rd b/man/aes.Rd index 1dd76b9eab..91bf731d84 100644 --- a/man/aes.Rd +++ b/man/aes.Rd @@ -33,7 +33,7 @@ its inputs are quoted to be evaluated in the context of the data. This makes it easy to work with variables from the data frame because you can name those directly. The flip side is that you have to use \link[rlang:quasiquotation]{quasiquotation} to program with -\code{aes()}. See a tidy evaluation tutorial such as the \href{http://dplyr.tidyverse.org/articles/programming.html}{dplyrprogramming vignette} +\code{aes()}. See a tidy evaluation tutorial such as the \href{http://dplyr.tidyverse.org/articles/programming.html}{dplyr programming vignette} to learn more about these techniques. } diff --git a/man/geom_smooth.Rd b/man/geom_smooth.Rd index 89c403187e..963106fd1a 100644 --- a/man/geom_smooth.Rd +++ b/man/geom_smooth.Rd @@ -49,9 +49,13 @@ to the paired geom/stat.} For \code{method = "auto"} the smoothing method is chosen based on the size of the largest group (across all panels). \code{\link[=loess]{loess()}} is used for less than 1,000 observations; otherwise \code{\link[mgcv:gam]{mgcv::gam()}} is -used with \code{formula = y ~ mgcv::s(x, bs = "cs")}. Somewhat anecdotally, +used with \code{formula = y ~ s(x, bs = "cs")}. Somewhat anecdotally, \code{loess} gives a better appearance, but is O(n^2) in memory, so does -not work for larger datasets.} +not work for larger datasets. + +If you have fewer than 1,000 observations but want to use the same \code{gam} +model that \code{method = "auto"} would use then set +\code{method = "gam", formula = y ~ s(x, bs = "cs")}.} \item{formula}{Formula to use in smoothing function, eg. \code{y ~ x}, \code{y ~ poly(x, 2)}, \code{y ~ log(x)}}