forge provides a set of helper functions for input checking and casting. It is intended to be used by package developers to interoperate with other language runtimes, such as Python and JVM languages.
You can install forge from CRAN with
install.packages("forge")
You can install the development version from GitHub with
devtools::install_github("rstudio/forge")
library(sparklyr)
sc <- spark_connect(master = "local")
spark_vector <- function(sc, x) {
v <- forge::cast_double_list(x)
invoke_new(sc, "org.apache.spark.ml.linalg.DenseVector", v)
}
spark_vector(sc, 1:3)
#> <jobj[14]>
#> org.apache.spark.ml.linalg.DenseVector
#> [1.0,2.0,3.0]
Please note that the ‘forge’ project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.