I am having issues with deploying an app in shinyapps.io. I am using a package from CRAN called DateTimeRangePicker
. The app works locally, but the specific package is missing when deployed. The goal is to use this CRAN package in shinyapps.io, which it is not currently doing. I'm not sure if I need to run a specific line of code or if I need to deploy with the CRAN package. I am stumped and was hoping someone could point me in the right direction.
library(shiny)
library(ggplot2)
library(dplyr)
library(DateTimeRangePicker)
not_sel <- "Not selected"
ui <- fluidPage(
fileInput("csv_input", "Select file", accept = ".csv"),
selectInput("y_axis", 'Select Variable', choices = c(not_sel), multiple = TRUE),
DateTimeRangePickerInput('date_range',from = '2024-06-11 14:00:00', to = '2024-06-11 14:00:05'),
actionButton('run', 'Run'),
plotOutput('plot')
)
server <- function(input,output){
options(shiny.maxRequestSize=900*1024^2)
data_input <- reactive({
req(input$csv_input)
df <- read.csv(input$csv_input$datapath)
return(df)
})
data_input_0 <- reactive({
data_input() |> mutate(y = lubridate::ymd_hms(timestamp))
})
data_filtered <- eventReactive(input$run,{
filter(data_input_0(), as.POSIXct(timestamp) >= as.POSIXct(input$date_range[1]) & as.POSIXct(timestamp) <= as.POSIXct(input$date_range[2]))
})
observeEvent(data_input(), {
choices <- c(names(data_input()))
updateSelectInput(inputId = "y_axis", choices = choices)
})
output$plot <- renderPlot(
ggplot(data_filtered(), aes(x = timestamp, y = .data[[input$y_axis]], group = input$y_axis))+geom_point() + geom_line()
)
}
shinyApp(ui = ui, server = server)