Will upcoming ggplot2::calc() clash with raster::calc()?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Will upcoming ggplot2::calc() clash with raster::calc()?

edzer
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
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: Will upcoming ggplot2::calc() clash with raster::calc()?

Barry Rowlingson
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 <
[hidden email]> 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
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: Will upcoming ggplot2::calc() clash with raster::calc()?

hadley wickham
We are tracking at https://github.com/tidyverse/ggplot2/issues/2614 —
and have come up with a name that I prefer to calc(): stat().

Hadley

On Wed, May 16, 2018 at 9:42 AM, Barry Rowlingson
<[hidden email]> wrote:

> 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 <
> [hidden email]> 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
>> [hidden email]
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo



--
http://hadley.nz

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo