I am trying to edit columns in a data frame yjay I uploadin using fileInput, however I keep getting the error "Operation not allowed without an active reactive context. (You tried to do something that can only be done from inside a reactive expression or observer.)". Does anybody know why I might be getting this error? Any help is greatly apprenticed!!
server = function(input, output) {
a1 = reactive({
if(is.null(input$myFile$datapath)) NULL
else{
read_excel(input$myFile$datapath)
}
})
x <- as.POSIXct(a1()$Month)
a1()$mo <- strftime(x, "%m")
a1()$yr <- strftime(x, "%Y")
a1()$qrt <- quarter(x, with_year = FALSE, fiscal_start = 01)
#subsetting data to display sales reps that hold a quota
newdata <- a1()[grepl("Y", a1()$`Quota Held Flag`),]
#fixing participation column into categorical for donut chart
newdata$Participation[is.na(newdata$Participation)] <- 0
newdata$Participation <- factor(newdata$Participation, labels =
c("0-99%","100%"))
#grouping data
newdata2 <- newdata %>%
group_by(yr, mo, qrt)
}
shinyApp(ui = ui, server = server)