Open-EO/openeo-r-client

Tidyverse methods for process graph generation

Closed this issue · 4 comments

Title Tidyverse methods for process graph generation
Date 2021-11-30
Issue #90
Category Usability, Integration with Tidyverse
Description The tidyverse eco-system of packages is a widely used concept in R. Integrating its logic would facilitate the use of openEO for R programmers. Tidyverse methods can be used for process graph building (https://r-spatial.github.io/stars/articles/stars3.html). The integration requires function overloading and mapping to openEO processes. Avoid loading whole tidyverse, only make them available when package is loaded, especially fun register_s3_method() https://github.com/r-spatial/stars/blob/master/R/tidyverse.R
Dependencies tidyverse
Links Integration of R spatial functionalities, https://r-spatial.github.io/stars/articles/stars3.html
Priority Medium
Impact Medium

To start with:
filter
...

@flahn, you have probably thought about using the pipe %>% for chaining functions to a process graph. I slightly remember that it also worked before?
Are you still fond of that idea?

flahn commented

Usually the pipe operator works. It depends on the parameter order of the unbound parameters in a function call. Currently the processes are parsed and build into the functions of the process list obtained by processes(). I can either make sure that the parameter requiring some sort of data cube is first, or we simply assume that in most cases this parameter comes somewhat first or at least the other parameters are set.

For example:

library(magrittr)
f = function(a,b,cube) {
  names(which(as.list(environment()) == "test"))
}

test = "test"

test %>% f()
test %>% f(a=1)
test %>% f(a=1,b=2)

Regarding this, I invite you to take a look at tidyopeneo, which I've been developing together with @edzer

https://github.com/hurielreichel/tidyopeneo

@flahn