[R-sig-Geo] Will upcoming ggplot2::calc() clash with raster::calc()?
Barry Rowlingson
b@rowling@on @ending from l@nc@@ter@@c@uk
Wed May 16 18:42:14 CEST 2018
It seems the options are:
1. ggplot2 and raster use calc - scripts will have to use raster::calc or
ggplot2::calc to be ambiguous.
This is the painful solution. Scripts will break. Users will have to type
raster::calc or ggplot2::calc depending on the order they do
library(raster);library(ggplot2). Both packages are often used together.
2. `calc` becomes a "generic" and despatches to the right specific function
when called on a raster or whatever ggplot2::calc needs.
This either requires "ggplot2" to have "raster" as a dependency or for the
generic to be moved to a package that each of these will depend on. An S3
or S4 generic? Will it even work? Nobody wants to manage the dependency.
3. Use a different name in `ggplot2`, for example, `val`, which has the
same sense - compare:
geom_histogram(aes(y = *calc*(count)))
geom_histogram(aes(y = *val*(count)))
4. ggplot2 does something else - maybe the aesthetic could be specified as
a formula?
geom_histogram(aes(y = ~count))
but that would require a chunk of ggplot2 rewriting
Barry
On Tue, May 15, 2018 at 6:58 PM, Edzer Pebesma <
edzer.pebesma at uni-muenster.de> wrote:
> This was asked on twitter:
> https://twitter.com/hadleywickham/status/996430251499536385 , by Hadley
> Wickham:
>
> "Can any raster user comment on if the new ggplot2::calc() function is
> going to cause significant pain because it clashes with raster::calc()?"
>
> I'll report answers back to twitter, or directly to Hadley if it doesn't
> fit in 280 chars.
> --
> Edzer Pebesma
> Institute for Geoinformatics
> Heisenbergstrasse 2, 48151 Muenster, Germany
> Phone: +49 251 8333081
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list