I've trained a model using R, but now I am trying to deploy it in the current stack using NodeJS, I know that the model can be store as an RDS, but I'm not sure if I can use this model externally. Has anyone done this?
            Asked
            
        
        
            Active
            
        
            Viewed 188 times
        
    1
            
            
        - 
                    2Related discussions [here](https://community.rstudio.com/t/r-code-in-production-options/2015) and [here](https://stackoverflow.com/q/22309236/324364). The latter is fairly old, but based on SO conventions also probably dangerously close to a duplicate. – joran Jun 28 '18 at 22:03
 
2 Answers
4
            I think there are 2 answers.
The general case:
- No, this is not only data represented in an R format (.RDS) it's also only really a "model" when it's being interpreted by not even just R, but the R library running on R that trained the model (
stats,caret,optimr, etc). So you could launch R from another language like NodeJS, but it will still need to hit R at some point in the process. 
and the exception
        Hack-R
        
- 22,422
 - 14
 - 75
 - 131
 
- 
                    Great answer! However, these days, one should use the `r2pmml` package (https://github.com/jpmml/r2pmml) for creating a PMML model in R, because it supports more model types, performs better and generates more correct/compact PMML documents. – user1808924 Jun 29 '18 at 14:05
 -