I want to be able to receive a data frame, do something with it, and spit out, using Plumber.
Code example:
# 1) I want to send Iris to my api
# 2) read it
# 3) do summary statistics on it
# 4) return these
# First create a .csv I want to send to my API
df <- iris
write.table(df, file = "myData.csv", sep = ";", dec =".", row.names = FALSE)
# How can I send example of this using windows?
library(plumber)
#' Do summary statistics on data frame
#' @get /post
# The function to run
function(df) {
# df <- read.table("myData.csv", header = TRUE, sep = ";", dec = ".")
df[, 1:4] <- apply(df[, 1:4], 2, as.numeric)
df[, 5] <- as.factor(df[, 5])
return(summary(df))
}
I can get the simple examples from the documentation working - but when it jumps to more complex examples, I think it assumes a lot and doesn't explain - for example how do I send things using curl? I guess this is a mac / linux way - but how can I test my API on a windows then?