I have saved a ARIMA model and Validation dataframe containing (sales & price) as RDS objects and trying to retrieve the same using REACTIVE functions.
server <- function(input,output) {
m_arima_model <- reactive({
readRDS(<path>)
})
m_valid_data <- reactive({
readRDS(<path>)
})
output$FC <- renderPlot({
m_fc <- forecast(m_arima_model(),
xreg =
m_valid_data()$price[1:input$horizon])
plot(m_fc)
})
But this is throwing the following error Error in as.vector: cannot coerce type 'closure' to vector of type 'character'
. I have also tried moving m_arima_model() to another variable inside renderPlot which throws the same error. Can you please help ?
I am not sure whether accessing the validation price using m_valid_data()$price[1:input$horizon]
is right as well. The horizon value is from input variables.