plumber allows you to create a REST API by merely decorating your existing R source code with special comments. Take a look at an example.

These comments allow plumber to make your R functions available as API endpoints. You can either prefix the comments with #* or #' but we recommend the former since #' will conflict with the Roxygen package.

You can visit this URL using a browser or a terminal to run your R function and get the results. For instance http://localhost:8000/plot will show you a histogram, and http://localhost:8000/echo?msg=hello will echo back the hello message you provided.

Here were using curl via a Mac/Linux terminal.

As you might have guessed, the requests query string parameters are forwarded to the R function as arguments (as character strings).

If youre still interested, check out our more thorough documentation.

You can install the latest stable version from CRAN using the following command:

If you want to try out the latest development version, you can install it from GitHub. The easiest way to do that is by using devtools.

Originally posted here:
plumber

Related Posts
September 19, 2018 at 10:42 am by Mr HomeBuilder
Category: Plumber