简体   繁体   English

无法使用R Shiny Server部署googleVis动态图

[英]Unable to deploy the googleVis motion chart using R shiny server

The motion chart appeared well on my own computer although the chart shows up on the other IE window instead of RStudio's internal window. 尽管运动图显示在另一个IE窗口而不是RStudio的内部窗口中,但它在我自己的计算机上显示的很好。 However, when I used the R Shiny server in order to deploy the googleVis motion chart on web, this error message shows: 但是,当我使用R Shiny服务器以在网络上部署googleVis动态图时,此错误消息显示:

  Error: $ operator is invalid for atomic vectors

I also checked them using the commands below and it shows they are not atomic: 我还使用以下命令检查了它们,结果表明它们不是原子的:

  >is.recursive(Fruits)
  [1] TRUE
  >is.atomic(Fruits)
  [1] FALSE

Reproducible code is as below, I've simplifed it and use the internal data "fruit" to demo it; 可复制的代码如下,我简化了它,并使用内部数据“水果”对其进行了演示; the problem is still there, the motion chart did not show in the same window but appear in another window in IE9. 问题仍然存在,动态图表没有显示在同一窗口中,而是出现在IE9的另一个窗口中。 And when deployed using shiny-server, it become worses, motion chart did not appear at all and shows the same error message 而且当使用Shiny-server进行部署时,情况变得更糟,运动图根本没有出现,并且显示了相同的错误消息

Server. 服务器。 R [R

  library(googleVis)
  library(shiny)
  shinyServer(function(input, output) {
    output$motionchart2 <- renderGvis({
     M1 <- gvisMotionChart(Fruits, idvar="Fruit", timevar="Year")
     plot(M1)
   })
  })

UI.R UI.R

  library(shiny)
  library(googleVis)
  shinyUI(fluidPage(
  titlePanel("Analysis"),
  mainPanel(
   navlistPanel(
    tabPanel("MotionChart",h1("Motion Chart"),tableOutput("motionchart2"))
  )
 )
 ) 
 )

You don't need plot function while rendering chart in renderGivs section. 在renderGivs部分中渲染图表时,您不需要绘图功能。 I have slightly modified server part of your code. 我对您的代码的服务器部分做了一些修改。 When you run application you have to open it in a browser otherwise chart will not be shown. 运行应用程序时,必须在浏览器中打开它,否则将不会显示图表。

library(shiny)
library(googleVis)

ui = shinyUI(fluidPage(
    titlePanel("Analysis"),
    mainPanel(
        navlistPanel(
            tabPanel("MotionChart",h1("Motion Chart"),tableOutput("motionchart2"))
        )
    )
))

server = shinyServer(function(input, output) {
    output$motionchart2 <- renderGvis({
        gvisMotionChart(Fruits, idvar="Fruit", timevar="Year")
    })
})

runApp(list(ui = ui, server = server))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM