Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

invoke

Invoke a Method on a JVM Object


Description

Invoke methods on Java object references. These functions provide a mechanism for invoking various Java object methods directly from R.

Usage

invoke(jobj, method, ...)

invoke_static(sc, class, method, ...)

invoke_new(sc, class, ...)

Arguments

jobj

An R object acting as a Java object reference (typically, a spark_jobj).

method

The name of the method to be invoked.

...

Optional arguments, currently unused.

sc

A spark_connection.

class

The name of the Java class whose methods should be invoked.

Details

Use each of these functions in the following scenarios:

invoke Execute a method on a Java object reference (typically, a spark_jobj).
invoke_static Execute a static method associated with a Java class.
invoke_new Invoke a constructor associated with a Java class.

Examples

sc <- spark_connect(master = "spark://HOST:PORT")
spark_context(sc) %>%
  invoke("textFile", "file.csv", 1L) %>%
  invoke("count")

sparklyr

R Interface to Apache Spark

v1.6.2
Apache License 2.0 | file LICENSE
Authors
Javier Luraschi [aut], Kevin Kuo [aut] (<https://orcid.org/0000-0001-7803-7901>), Kevin Ushey [aut], JJ Allaire [aut], Samuel Macedo [ctb], Hossein Falaki [aut], Lu Wang [aut], Andy Zhang [aut], Yitao Li [aut, cre] (<https://orcid.org/0000-0002-1261-905X>), Jozef Hajnala [ctb], Maciej Szymkiewicz [ctb] (<https://orcid.org/0000-0003-1469-9396>), Wil Davis [ctb], RStudio [cph], The Apache Software Foundation [aut, cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.