I have a logistic regression algorithm in R to predict irresponsible users. I need this to be as flexible as possible for any market. I would need to use the logistic regression algorithm to calculate the weights so that the model can (after training and testing) predict the irresponsible users. I am confused whether I should create an R package or use REST API to call the code and perform the algorithm.

Does anyone know which one would be better?


They do different things.

An R package bundles R scripts (and potentially other code) together so that it is easily installable, its requirements are clear, and it is documented.

A REST API is a way for you to set up your code so that another process (or another computer) can call it, giving it input and receiving output.

Do you want to document your code and bundle it so it is easy to install? Then you should make a package. With a package, you can also publish your code if you want, so others can install and use it.

Do you want other processes/computers to use your code? Then you need an API.

Do you want both? Then you need both.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.