Hi, I'm currently trying to have the mean of a column change based on what someone does in the data filter of a data table, but I'm confused as to how I would do this (there aren't any inputs to react off of. Here is the relevant code from the server, which is wrong (The mean for the original data will work, not the filtered data). EDIT: Sorry, I should have include what I did in the UI. Here it is:
dataTableOutput("CO2Table")
server <- function(input, output) {
reactedData = CO2
data = CO2
output$CO2Table <- renderDataTable({
data
reactedData = data.frame(data)
},
filter = 'top',
rownames = FALSE,
options = list(autoWidth = TRUE, columnDefs = list(list(width= '200px', targets="_all"))))
output$text_example = renderText({paste("Mean: ", mean(reactedData$conc))})
}