I am seeking to have a checkbox option to tsclean the dataset uploaded to my shiny. However, I am unsure how to get it to work, the code works either way without the checkbox. input$smooth is my checkbox input and data()[[input$col]] is the dataset required to be cleaned.
I would like values$int to have the dataset cleaned on selection of the checkbox. The recalculation must be done upon clicking the action_Calc. The ui launches but there is no functionality when I include the if statement, so therefore I assume I have put it in the wrong part of code.
Many thanks
server
Data <- reactive({
req(input$file1)
inFile <- input$file1
read_excel(inFile$datapath, 1)
})
output$contents <- renderTable(bordered = TRUE, hover = TRUE, {
Data()
})
values<- reactiveValues()
observe({
input$action_Calc
values$int<- isolate({
round( input$SL*sqrt(input$LT/4)*sd(Data()[[input$col]]), digits = 2)
if (input$smooth) {round( input$SL*sqrt(input$LT/4)*sd(tsclean(Data()[[input$col]]),
replace.missing= TRUE, lamda = NULL) , digits= 2)
}
})
})
output$SS <- renderText({paste("Calculated is...", values$int)} )
Aucun commentaire:
Enregistrer un commentaire