Convert R code to Kotlin

R is dynamically typed, interpreted, and lazily evaluated. Kotlin isn’t any of those things. It has also probably got a lot of features that Kotlin doesn’t have, so sadly there isn’t a 1 to 1 conversion button that will just magically fix all the performance problems. I’d suggest that you take a look either at Kotlin scripting or Kotlin Native and learn how Kotlin itself works, and then migrate your codebase by rewriting the code in Kotlin.

It also seems that R has some interop capabilities with Java, and so you might be able to migrate only the performance critical parts into Kotlin JVM and call that from your R code.

Maybe also take a look at pqR?

1 Like