R library to assist in creating and running blocks (cloud functions) with Blockspring.
install.packages("devtools")
library("devtools")
install_github("blockspring/blockspring.R")
Save the following script to an example.R file:
library("blockspring")
myBlock <- function(request, response){
sum <- as.numeric(request$params$num1) + as.numeric(request$params$num2)
response$addOutput("sum", sum)
response$end()
}
blockspringDefine(myBlock)
Then in your command line write:
Rscript example.R --num1=20 --num2=50
or
echo '{"num1":20, "num2": 50}' | Rscript example.R
MIT
Email us: founders@blockspring.com