Hi,
Below is the code. I am not mentioning the UID and Password for security purpose.
library(shiny)
library(forecast)
library(rsconnect)
library(DBI)
Define UI
ui <- fluidPage(
# Application title
titlePanel("Forecasting Model"),
# Sidebar with a slider input for number of bins
sidebarLayout(
sidebarPanel(
sliderInput("bins",
"Number of weeks:",
min = 1,
max = 50,
value = 30)
),
# Show a plot of the generated distribution
mainPanel(
plotOutput("distPlot"),
tableOutput("dataTable")
)
)
)
Define server
server <- function(input, output) {
output$distPlot <- renderPlot({
library(forecast)
conn<- DBI::dbConnect(odbc::odbc(),
snowflake="SnowflakeDSIIDriver",
Driver = "/usr/lib/snowflake/odbc/lib/libSnowflake.so",
server = ".eu-west-1.snowflakecomputing.com.",
role = "SYSADMIN",
database = "TAL_SF",
Schema = "TS",
warehouse = "TAL_SF_WH",
UID=" ",
pwd=' ',
timeout = 10)
forecast<-DBI::dbGetQuery(conn,"SELECT * FROM FORECAST_WEEKLY")
y=ts(forecast[,2],start=c(2010,2),frequency=52)
fit_arima<-auto.arima(y,d=1,D=1,stepwise = FALSE,approximation = FALSE,trace = TRUE)
fst<-forecast(fit_arima,h=input$bins)
plot(fst)
#print(summary(fst))
})
output$dataTable<-renderTable({
conn<- DBI::dbConnect(odbc::odbc(),
snowflake="SnowflakeDSIIDriver",
Driver = "/usr/lib/snowflake/odbc/lib/libSnowflake.so",
server = ".eu-west-1.snowflakecomputing.com.",
role = "SYSADMIN",
database = "TAL_SF",
Schema = "TS",
warehouse = "TAL_SF_WH",
UID=" ",
pwd=' ',
timeout = 10)
forecast<-DBI::dbGetQuery(conn,"SELECT * FROM FORECAST_WEEKLY")
y=ts(forecast[,2],start=c(2010,2),frequency=52)
fit_arima<-auto.arima(y,d=1,D=1,stepwise = FALSE,approximation = FALSE,trace = TRUE)
fst<-forecast(fit_arima,h=input$bins)
head(print(summary(fst)))
})
}
Run the application
shinyApp(ui = ui, server = server)
This code works fine with Run App. But when publishing it shows publish content issues
Line 36 Path should be a file within the project directory
line 56 Path should be a file within the project directory
Here line 36 and 56 are
Driver = "/usr/lib/snowflake/odbc/lib/libSnowflake.so",
This line
Thanks,
Swapna