部署到shinyapp.io

时间:2016-02-03 14:17:18

标签: r shiny

我是一个相对简单的闪亮应用程序,它以不同的方式绘制一些在本地运行良好的数据,但我尝试按照说明here部署到shinyapps.io并且遇到了一些错误,我和# 39;不知道如何解决(或从哪里开始寻找)。我没有任何问题进行身份验证,但是当我去部署它时,我收到以下错误消息...

> shinyapps::deployApp('~/Dropbox/R/nmisc/inst/shiny/cams/')
Preparing to deploy application...Update application currently deployed at
https://slackline.shinyapps.io/cams/ ? [Y/n] y
DONE
Uploading bundle for application:81835...Error in findLocalRepoForPkg(pkg,
repos, fatal = fatal):No package 'XML' found in local repositories specified

最初我没有显式加载XML库(并且猜测它可能被其他东西作为依赖项拉入)。我已将它安装在我的系统上,因此将其添加到由ui.Rserver.R加载的库中,但仍会出现相同的错误。

我很难过,无法解决最新情况,但是shinyapps.io上没有XML的情况吗?这看起来有点奇怪。

traceback()以防它有用/提供信息......

> traceback()
18:stop("No package '", pkg, "' found in local repositories specified")
17:findLocalRepoForPkg(pkg, repos, fatal = fatal)
16:getPackageRecordsLocalReposImpl(pkgName, repos, fatal = fatal)
15:FUN(X[[i]], ...)
14:lapply(pkgNames, function(pkgName) {
  getPackageRecordsLocalReposImpl(pkgName, repos, fatal = fatal)
})
13:getPackageRecordsLocalRepos(pkgNames, local.repos, fatal = !fallback.ok)
12:getPackageRecords(
  inferredPkgsNotInLib, project = project, available = available,
  check.lockfile = TRUE, fallback.ok = fallback.ok
)
11:packrat::.snapshotImpl(project = bundleDir, snapshot.sources = FALSE,
                          verbose = FALSE)
10:withCallingHandlers(
  expr, message = function(c)
    invokeRestart("muffleMessage")
)
9:suppressMessages(packrat::.snapshotImpl(
  project = bundleDir,
  snapshot.sources = FALSE, verbose = FALSE
))
8:performPackratSnapshot(bundleDir)
7:addPackratSnapshot(appDir, implicit_dependencies)
6:snapshotDependencies(appDir, inferDependencies(appMode, hasParameters))
5:createAppManifest(
  bundleDir, appMode, contentCategory, hasParameters,
  appPrimaryDoc, assetTypeName, users
)
4:bundleApp(target$appName, appDir, appFiles, appPrimaryDoc, assetTypeName,
            contentCategory)
3:force(code)
2:withStatus(paste0("Uploading bundle for ", assetTypeName, ": ",
                    application$id), {bundlePath <-bundleApp(target$appName,
        appDir, appFiles, appPrimaryDoc, assetTypeName, contentCategory)
        bundle <- client$uploadApplication(application$id, bundlePath)})
1:shinyapps::deployApp("~/Dropbox/R/nmisc/inst/shiny/cams/") 

我的ui.Rserver.R关注(nmisc是一个个人包,其中包含正在绘制的cams.df数据框。

ui.R

library(dplyr)
library(ggplot2)
library(nmisc)
library(shiny)
library(magrittr)
library(RColorBrewer)
library(XML)
shinyUI(fluidPage(
  titlePanel("Cam Comparison"),
  sidebarPanel(
    width = 4,
    p(
      "Welcome, this website provides comparisons of different climbing cams.
      Its a work in progress, if you have feedback, comments or ideas please
      email the",
      HTML(
        '<a href="mailto:sheffieldboulder.uk@gmail.com?subject=\'Cam site
        suggestions\'">author</a>'
      ),"."
    )
),
sidebarPanel(
  width = 4,
  selectInput(
    inputId  = 'to.compare',
    label    = 'Choose cams to compare :',
    choices  = c(unique(cams.df$manufacturer.model)),
    ## selected = 'All',
    multiple = TRUE
  )
),
sidebarPanel(
  width = 4,
  selectInput(
    inputId  = 'free.x.axis',
    label    = 'Free x-axis :',
    choices  = c('Yes', 'No'),
    selected = 'No',
    multiple = FALSE
  )
),
mainPanel(width = 12,
          column(
            12,
            tabsetPanel(
              tabPanel("Range by Cam",
                       fluidRow(
                         plotOutput("all.manufacturer",
                                    width  = 'auto',
                                    height = '1000px')
                       )),
              tabPanel("Range by Model",
                       fluidRow(
                         plotOutput("model.range",
                                    width  = 'auto',
                                    height = '1000px')
                       )),
              tabPanel("Range v Strength",
                       fluidRow(
                         plotOutput("range.strength",
                                    width  = 'auto',
                                    height = '1000px')
                       )),
              tabPanel("Range v Weight",
                       fluidRow(
                         plotOutput("range.weight",
                                    width  = 'auto',
                                    height = '1000px')
                       )),
              tabPanel("ToDo",
                       fluidRow(
                         shiny::p(
                           "Here are a list of some of the things I've not
                           done, would like to, or that have been suggested..."
                         ),
                         shiny::HTML(
                           "<ul><li> Align similar size cams in the same
plot rather than faceted. <li> Colour code cams to manufacturers colours.
<li> Mix and match individual cams from a manufacturers range.<li>
Select an individual cam and show all similar cams across manufacturers
(possibly restricted to those of interest).
                           </ul>"
                         )
                         ))
                         )
          ))
          ))

server.R

library(dplyr)
library(ggplot2)
library(nmisc)
library(shiny)
library(magrittr)
library(RColorBrewer)
library(XML)

shinyServer(function(input, output) {
  # Subset the data
  #
  # See Lesson 5 and 6
  #
  # http://shiny.rstudio.com/tutorial/lesson5/
  # http://shiny.rstudio.com/tutorial/lesson6/
  # https://stackoverflow.com/questions/32148144/condition-filter-in-dplyr-
  # based-on-shiny-input

  dataInput <- reactive({
    if (is.null(input$to.compare)) {
      cams.df
    }
    else{
      filter(cams.df,
             manufacturer.model %in% input$to.compare)
    }
  })
  ## Set scales based on responses
  scales <- reactive({
    if (input$free.x.axis == "Yes") {
      'free_x'
    }
    else{
      'free_y'
    }
  })
  ## By Manufacturer
  output$all.manufacturer <- renderPlot({
    cam.plot <- cams(
      df          = dataInput(),
      smooth      = 'loess',
      free.scales = scales(),
      wrap.col    = 6,
      text.size   = 16
    )
    cam.plot$all.manufacturer
  })
  ## By Model Range
  output$model.range <- renderPlot({
    cam.plot <- cams(
      df          = dataInput(),
      smooth      = 'loess',
      free.scales = scales(),
      wrap.col    = 6,
      text.size   = 16
    )
    cam.plot$manufacturer.model
  })
  ## Range v Strength
  output$range.strength <- renderPlot({
    cam.plot <- cams(
      df              = dataInput(),
      smooth          = 'loess',
      free.scales     = scales(),
      wrap.col        = 6,
      text.size       = 16,
      exclude.outlier = TRUE
    )
    cam.plot$range.strength
  })
  ## Range v Weight
  output$range.weight <- renderPlot({
    cam.plot <- cams(
      df          = dataInput(),
      smooth      = 'loess',
      free.scales = scales(),
      wrap.col    = 6,
      text.size   = 16
    )
    cam.plot$range.weight
  })
})

1 个答案:

答案 0 :(得分:0)

我不确定这是否可行,但是,您是否在计算机中安装了XLL库?