我目前正在尝试部署使用dygraphs软件包到shinyapps.io的R闪亮应用程序。我的应用程序在本地工作正常,但当我尝试部署它时说找不到网页 - " HTTP 500内部服务器错误"。我的UI代码是:
shinyUI(fluidPage(
titlePanel("MyApp"),
fluidRow(
column(12,
p("Info Text")
,dygraphOutput("plot")
)
)
))
和服务器代码是:
shinyServer(function(input, output) {
library(shiny)
library(dygraphs)
output$plot<- renderDygraph({
data <- read.csv("data.csv", header=TRUE, sep =",",na.strings="-")
dygraph(data, main = "Plot") %>%
dyLegend(width = 170 ,
labelsSeparateLines = TRUE ,
show = "always") %>%
dyOptions(stackedGraph = FALSE)
当我从UI代码中删除dygraphOutput函数时,app会成功部署。有没有人遇到与dygraphs类似的问题?
答案 0 :(得分:0)
对我来说一切正常,我认为问题出在您的csv
文件中。您可以看到我的应用程序正常使用此代码:
library(shiny)
library(dygraphs)
shinyServer(function(input, output,session) {
data <- readRDS("data.rds")
output$plot<- renderDygraph({
req(data)
dygraph(data, main = "Plot") %>% dyLegend(width = 170 , labelsSeparateLines = TRUE , show = "always") %>%dyOptions(stackedGraph = FALSE)
})
})
rm(list = ls())
library(shiny)
library(dygraphs)
ui <- fluidPage(
titlePanel("MyApp"),
fluidRow(
column(12,p("Info Text"),dygraphOutput("plot"))
)
)