r - Creating a custom Stat object in ggplot2 -
i'd create custom stat object ggplot2. (specifically i'd create smoother works differently ones stat_smooth
allows- instance, without y~x
modeling function- there other custom stats i'd create if there workaround specific case).
i found this suggested solution hadley wickham:
statexpo <- proto(stat, { objname <- "expo" desc <- "exponential smoothing" default_geom <- function(.) geomline calculate_groups <- function(., data, scales, variable="x", ...) { data$y <- holtwinters(data$x, ...) } }) stat_expo <- statexpo$new
however, when try get:
error in proto(stat, { : object 'stat' not found
upon looking around ggplot code, found where stat defined. however, stat
object is, far can tell, never exported ggplot2.
i write new stat object within ggplot2/r
folder , reinstall package, cumbersome , make solution difficult share others. how can create custom stat object outside of ggplot namespace?
ggplot2:::stat
can used access non-exported object.
Comments
Post a Comment