I would like to be able to calculate a new column of data based on dividing one column by another, with both original columns selected by a user input. I would like to have
You don't return anything in your reactive
for selectedData2
you just do an incrementation <-
, I think you should do this :
function(input, output, session) {
# Combine the selected input variables into a new data frame
selectedData <- reactive({
return(iris[, c(input$xcol, input$ycol),])
})
# divide one variable selection by the other
selectedData2 <- reactive({
new<-iris[, c(input$xcol)]/iris[, c(input$ycol)]
return(new)
})
# create data output for selected variables
output$view <- renderTable({selectedData()
})
# create data output for calculated variable
output$view2 <- renderTable({selectedData2()
})
}