
Last chance! 50% off unlimited learning
Sale ends in
These functions convert R objects to Scala references and vice versa. The function scalaConvert
supports copyable types whereas
scalaConvert.data.frame
supports data frames. These functions provide prototypes for others to write their own conversions
for other types. Factors in data frames are converted to strings when converting to Scala.
scalaConvert(x, interpreter = findScalaInstance())scalaConvert.data.frame(x, interpreter = findScalaInstance())
An R object to convert to a Scala reference.
An instance of a Scala interpreter.
# NOT RUN {
scala(serialize.output=TRUE)
identical(pi, scalaConvert(scalaConvert(pi)))
identical(mtcars, scalaConvert.data.frame(scalaConvert.data.frame(mtcars)))
dfInScala <- scalaConvert.data.frame(ToothGrowth)
dfInScala$keys()
dfInScala$apply("supp")$"_2"()
dfInScala$apply("supp")$"_1"()
# }
Run the code above in your browser using DataLab