Only prefer binary if compilation is needed
Move R code out of C++ into plain R script