Compile external library inside an R package

Viewed 180

I am building an R package with algorithms for ordinal and monotonic data classification, and I have a method called svmop that uses a version of a external library called libsvm-weights that is implemented in C but has a python wrapper.

I am using that library thought python using reticulate package, this way:

...
svmopredict<-function(models,test){
mysvm<-import_from_path("svmutil",system.file("python","python",package ="pkgName"))
pred<-mysvm$svm_predict(...)
...

where svmutil is placed in package/inst/python/python. However, that actually requires a built shared library to work. Actually I have the shared library built for linux and placed under package/inst/python , but as far as I know any form of binaries are unacceptable to CRAN.

So is there any way to indicate the package to compile that library for windows or linux depending on the machine it is being installed? or is there any other better way to to this while being CRAN acceptable?

0 Answers
Related