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

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -