Does anyone know how to add data table, run some algorithm and save answer using R Rook application? I have a problem reading data in my application.
Where I should write data <- read.csv(file = "BASE_CASE.csv" )
in Rook.app_2 function or in write.data.HMTL
function and how?
Below is a code of my application function:
Rook.app_2 <- function(env) {
iter <<- iter + 1
request <- Request$new(env)
response <- Response$new()
# I believe that the problem is in line below
#I ve got this file in my working direction
data <- read.csv(file = "BASE_CASE.csv" )
## Add functionality to upload CSV-file
if (!is.null(request$POST())) {
## Read data from uploaded CSV-file
data <- request$POST()[["data"]]
data <- read.csv(data$tempfile)
}
write.initial.HTML(response, iter)
write.counting.HTML(request, response)
write.iris.HMTL(request, response, R.server)
write.data.HMTL(request, response, R.server)
write.final.HTML(response)
response$finish()
}
I am using this example for my application: https://www.r-bloggers.com/a-simple-web-application-using-rook/