ee_utils_pyfunc: Wrap an R function in a Python function with the same...

Description Usage Arguments Value Note Author(s) See Also Examples

Description

This function could wrap an R function in a Python function with the same signature. Note that the signature of the R function must not contain esoteric Python-incompatible constructs.

Usage

1

Arguments

f

An R function

Value

A Python function that calls the R function f with the same signature.

Note

py_func has been renamed to ee_utils_pyfunc just to maintain the rgee functions name's style. All recognition for this function must always be given to reticulate.

Author(s)

Yuan Tang and J.J. Allaire

See Also

Other ee_utils functions: ee_utils_py_to_r(), ee_utils_shp_to_zip()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
## Not run: 
library(rgee)
ee_Initialize()

# Earth Engine List
ee_SimpleList <- ee$List$sequence(0, 12)
ee_NewList <- ee_SimpleList$map(
  ee_utils_pyfunc(
    function(x) {
      ee$Number(x)$add(x)
    }
  )
)

ee_NewList$getInfo()

# Earth Engine ImageCollection
constant1 <- ee$Image(1)
constant2 <- ee$Image(2)
ee_ic <- ee$ImageCollection(c(constant2, constant1))
ee_newic <- ee_ic$map(
  ee_utils_pyfunc(
    function(x) ee$Image(x)$add(x)
  )
)
ee_newic$mean()$getInfo()$type

## End(Not run)

csaybar/rgee documentation built on March 11, 2021, 5:48 a.m.