闪亮的服务器错误 - 找不到函数“renderplot”

时间:2015-10-25 05:48:45

标签: shiny chord

我是Shiny的新手,我正在尝试为闪亮的服务器添加和弦图。当我点击RStudio中的runApp按钮时,我得到应用程序运行并生成UI,但随后立即关闭并在RConsole窗口中出现以下错误:错误(结构(函数(输入,输出):   找不到函数“renderplot”。

不幸的是,我无法附加数据,因为它是专有的,但我只是创建一个邻接矩阵以生成和弦图。 Chord图在Shiny外面很好用。提前谢谢!

我的用户界面和服务器代码如下:

library(shiny)

# Starting line
shinyUI(fluidPage(

  # Application title
  titlePanel("Chord Chart"),

  # Sidebar
  sidebarLayout(
    sidebarPanel(
      #Data selection for Chord Chart
      selectInput("data","Select a Dataset:",
                  c("Marine"))),

    #The plot created in server.R is displayed
    mainPanel(
      plotOutput("plot")
)))
)

library(circlize)
library(dplyr)
library(reshape2)
library(manipulate)
library(shiny)


# read marine summaries
marine <- readfile("C:/Personal/R/MarineDataSummary.csv")

# group and summarize by O-D
marine.sum <- marine %>%group_by(Handling_Port, OD_Port_Country) %>%
  summarise(tons <-sum(tonnes))    # prepare pivot table
marine.sum1 <- acast(marine.sum, Handling_Port~OD_Port_Country, value.tons="z")    # reshape matrix
marine.sum1[is.na(marine.sum1)] <- 0    # set NA to zero

#initialization of server.R
shinyServer(function(input, output) {

  output$plot <- renderplot({
    c <- chordDiagram(marine.sum1,annotationTrack="grid",preAllocateTracks=list(track.height = 0.3))
    ##change axis
    c <- c + circos.trackPlotRegion(track.index=1, panel.fun=function(x,y) {
      xlim = get.cell.meta.data("xlim") 
      ylim = get.cell.meta.data("ylim")
      sector.name=get.cell.meta.data("sector.index")
      circos.text(mean(xlim), ylim[1], sector.name,facing="clockwise",
                  niceFacing=TRUE,adj=c(0,0.4), cex = 0.4)},bg.border=NA)
    print(c)

  })
})

0 个答案:

没有答案