Creating new stats and geoms

83 views
Skip to first unread message

Simon Byrne

unread,
Jul 26, 2013, 7:27:12 AM7/26/13
to ggplo...@googlegroups.com
I have defined a new stat and geom, which I'm trying to wrap in a package. I want to export only the accessing functions stat_foo and geom_foo, and not the underlying proto object StatFoo and GeomFoo (i.e. the same behaviour as ggplot2 itself), however when I try to use the stat, I get the error: "Error: No geom called foo" (and vice-versa if I call the geom). The error seems to be cause by the "find" method in the TopLevel proto, as it only searches it's accessible functions. I've tried adding a "find" method to my protos, hoping this would overwrite the default one, but this didn't seem to help. Any ideas?

-Simon

Hadley Wickham

unread,
Jul 26, 2013, 12:45:43 PM7/26/13
to Simon Byrne, ggplo...@googlegroups.com
Hi Simon,

Do you have any reproducible code available? (pointer to github repo?)

Hadley
> --
> You received this message because you are subscribed to the Google Groups
> "ggplot2-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ggplot2-dev...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



--
Chief Scientist, RStudio
http://had.co.nz/

Simon Byrne

unread,
Jul 26, 2013, 2:00:52 PM7/26/13
to ggplo...@googlegroups.com, Simon Byrne
Hi Hadley,

I've put what I have here:
(sorry, for some reason "install_github" won't work for me, but if you clone it, the usual "install" seems to work fine).

I've explicitly exported GeomFunnel and StatFunnel, but if I don't and attempt an install, I get the "No stat/geom called funnel" error.

Many thanks,
-Simon

Hadley Wickham

unread,
Jul 30, 2013, 11:30:08 AM7/30/13
to Simon Byrne, ggplo...@googlegroups.com
It's not ideal, but you can explicit refer to the geom/stat objects:

stat = StatFunnel

unfortunately I didn't fully appreciate how people might want to add
new geoms and stats when I initially wrote the geom/stat finding code.

Hadley

Simon Byrne

unread,
Jul 30, 2013, 11:36:29 AM7/30/13
to ggplo...@googlegroups.com, Simon Byrne
Fantastic, thanks. It should be okay in this case, as the geom and stat are pretty much tied together.

-simon
Reply all
Reply to author
Forward
0 new messages