JuliaFunction-class: Proxy Objects in R for Julia Functions

Description Usage Arguments Details Slots Examples

Description

A class and generator function for proxies in R for Julia functions.

Usage

1
2
3
4
5
JuliaFunction(...)

## S4 method for signature 'JuliaFunction'
initialize(name, module = "", evaluator =
RJulia(, ...))

Arguments

name, module

The name and module of the Julia function.

evaluator

The evaluator object to use. By default, and usually, the current evaluator is used, and one is started if none has been.

...

For RJulia, the arguments as interpreted by the initialize method, so typically name and optionally module. Remaining arguments are passed along to the next method.

Details

An object from this class is an R function that is a proxy for a function in Julia. Calls to the R function evaluate a call to the Julia function. The arguments in the call are converted to equivalent Julia objects; these typically include proxy objects for results previously computed through the XRJulia interface.

Slots

name

the name of the server language function

module

the name of the module, if that needs to be imported

evaluatorClass

the class for the evaluator, by default and usually, JuliaInterface

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
  if(findJulia(test = TRUE) ) {
    ## even so, the Julia may not be valid
    ## so we catch any errors in the example, mainly to keep CRAN quiet
    tryCatch( {set.seed(228)
      x <- matrix(rnorm(1000),20,5)
      xm <- juliaSend(x)
      juliaCommand("using LinearAlgebra")
      svdJ <- JuliaFunction("svd")
      sxm <- svdJ(xm)
      sxm
    }, error = function(e) message("Julia Example error: " ,e$message))}

Example output



XRJulia documentation built on May 6, 2019, 1:01 a.m.