4

RStudio Shiny サーバーを実行していて、https: //github.com/rstudio/ggvis から ggvis をインストールしましたが、サーバーでデモの例を再現できません。

サーバーにインストールされた同じバージョン (3.1.0) で R を実行すると、次のことができます。

> library("shiny")
> library("ggvis")
The ggvis API is currently rapidly evolving. We strongly recommend that you do not rely on this for production, but feel free to explore. If you encounter a clear bug, please file a minimal reproducible example at https://github.com/rstudio/ggvis/issues. For questions and other discussion, please use https://groups.google.com/group/ggvis.

Attaching package: "ggvis"

The following object is masked from "package:stats":

    filter

> ggvis::ggvisOutput
function (plot_id = rand_id("plot_id")) 
{
    ggvisOutputElements(plot_id, spec = NULL, shiny = TRUE)
}
<environment: namespace:ggvis>

しかし、デモ フォルダの 1 つで例を試すと、次のようになります。

# ui.R
shinyUI(pageWithSidebar(
  div(),
  sidebarPanel(
    sliderInput("n", "Number of points", min = 1, max = nrow(mtcars),
                value = 10, step = 1),
    uiOutput("plot_ui")
  ),
  mainPanel(
    ggvisOutput("plot"),
    tableOutput("mtc_table")
  )
))

# server.R   
library("ggvis", lib.loc="/opt/R/R-3.1.0/lib64/R/library")))

shinyServer(function(input, output, session) {
  # A reactive subset of mtcars
  mtc <- reactive({ mtcars[1:input$n, ] })

  # A simple visualisation. In shiny apps, need to register observers
  # and tell shiny where to put the controls
  mtc %>%
    ggvis(~wt, ~mpg) %>%
    layer_points() %>%
    bind_shiny("plot", "plot_ui")

  output$mtc_table <- renderTable({
    mtc()[, c("wt", "mpg")]
  })
})

私は得る:

ERROR: could not find function "ggvisOutput"

ステートメントを含む行をコメントアウトするとggvisOutput、ページは通常どおりレンダリングされますが、プロットは表示されません。

何か案は?

4

1 に答える 1