Call R from Kotlin or embed R inside Kotlin
Embedded R inside Kotlin
Demo output
R code which is running inside Kotlin, simply add number 2 all the incoming array values and return
myfunc <- function(p1) {
cat("Incoming value from Kotlin: ", p1, "\n");
return(p1 + 2)
}
The Kotlin code which runs the R