I have figured out how to build an API end point using plumberDeploy at Digital Ocean. This example works as expected
#* Return the sum of two numbers
#* @param a The first number to add
#* @param b The second number to add
#* @get /sum
function(a, b) {
as.numeric(a) + as.numeric(b)
}
This example does not work as expected
#* Return the sum of two numbers
#* @param a The first number to add
#* @param b The second number to add
#* @get /sum
function(a, b) {
myAdd(a,b)
}
myAdd <- function(x,y){
x + y
}
How can I have custom functions that work inside the API endpoint? This is a toy example, my real world scenario has many other functions that do not live in an R package and I do not want to build a package.