I am doing the following:
- using R ShinyUI, get client inputs on ranges of variables A, B, C;
- in R ShinyServer, read in a csv file, and using the client inputs to slice the csv, and get the portion that I need;
- Perform a loop calculation on the csv, calculate various statistics from the loop output, and plot all these statistics.
Pseudo code:
data = read.csv('file.csv')
shinyServer(function(input, output) {
data <- reactive({
data = data[data$A<INPUT1 & data$B> INPUT2 & data$C<INPUT3,]
})
for (i in 1:dim(data)[1]){
result1[i] = xxx
result2[i] = xxx
}
output$plot <- renderPlot({
plot(result1)
})
})
The above code does not work. I want to know:
- How to correctly incorporate user input and get the variable "data,"
- How to plot result1 and result2 from output$plot
Thanks!