I'm creating a shiny app with local persistent data referred from Dean Attali blog as in section: 1. Local file system (local).
My query is, is it possible to create value box output from this method?
aggregates data from inputs
formData <- reactive({
formdata <- c("Associate Name" = input$aname,"Associate Email"=input$aemail,"Client Name" = input$cname,
"Client Email"=input$cemail,"Ask By Customer"=input$ask,"Remarks"=input$rem ,
"Date" = as.character(input$date), "Followup Date" = as.character(input$fdate))
formdata <- t(formdata)
formdata
})
saves data to csv (this creates a separate file every time we submit)
saveData <- function(formdata) {
fileName <- sprintf("%s_%s.csv",
humanTime(),
digest::digest(formdata))
write.csv(x = formdata, file = file.path(responsesDir, fileName),
row.names = FALSE, quote = TRUE)
}
loads the data (Binding all csv's which contains responses)
Data <- reactive( {
# Read all the files into a list
files <- list.files(responsesDir, full.names = TRUE)
data <- lapply(files, read.csv, stringsAsFactors = FALSE)
# Concatenate all data together into one data.frame
data <- do.call(rbind, data)
data <- data.frame(data)
data
}
displaying data in a table
output$responses <- DT::renderDataTable({
input$submit
Data()
})
I would like to know if we could create valueBoxOutput to display number of times an Associate name is recorded, number of times a client name has been recorded
E.g: someClient - 10, someAssociate - 5
This is my first shiny app, please help me through this. Thanks in advance!!
I figured it how to do it. the trick is in how we using the reactive function.
output$billing <- renderValueBox({
valueBox(value = length(Data()$Billing[Data()$Billing =="Yes"]),
subtitle = "No. of RFP's billed", color = "green",icon=icon("money",lib = "font-awesome"))
})