我能够使用shinyapps部署我的应用程序,但我一直收到错误:
ERROR: first argument is not an open RODBC channel
我的应用包含3个文件:
ui.R
server.R
plots.R
plots.R:
library(RODBC)
library(ggplot2)
queryfunction <- function(channel) {
myconn <- odbcConnect(dsn = "SQLServer")
query = "my query"
df <- sqlQuery(channel = myconn, query = query)
odbcClose(myconn)
return(df)
}
plotfunction <- function(channel) {
a <- ggplot(queryfunction(channel), aes(x = Month, y = Volume)) +
geom_bar(stat='identity')
return(a)
}
server.R:
library(shiny)
source('plots.R')
shinyServer(function(input, output,session) {
#general volume, value, and table plots
output$plot1 <- renderPlot({plotfunction(channel)})
})
这在我自己的计算机上完全正常,但不知何故在服务器上它没有。有谁知道这是什么问题?