2
votes

I've a relatively simple shiny app that plots some data in different ways that runs fine locally but I am trying to deploy to shinyapps.io following the instructions here and have hit some errors that I've no idea how to resolve (or where to start looking). I authenticate without any problems but when I go to deploy it I get the following error message...

> 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

Initially I had not explicitly loaded the XML library (and guessed it might be being pulled in as a dependency by something else). I have it installed on my system anyway so added it to the libraries that were loaded by ui.R and server.R but still get the same error.

I'm stumped and can't work out whats going on, but is it a case that XML is not available on shinyapps.io? That would seem a bit strange.

The traceback() in case it is useful/informative...

> 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/") 

And my ui.R and server.R follow (nmisc is a personal package that contains cams.df data frame which is being plotted).

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:[email protected]?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://stackguides.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
I just had this error with XML no package installed, when trying to load library(xml).( It used to work normal earlier). The easy fix for me was remove.packages("XML") and reinstall it with dependencies = TRUE. install.packages('XML', dependencies = TRUE).user5249203
@user5249203 tried that at home last night, it then complained about colorspace in the same manner. I've reinstalled all packages from scratch and now get an complaint about my own personal package nmisc not being found in local repositories yet I have it installed locally (under ~/.R/lib/ set from ~/.Renviron) and its loaded.slackline

1 Answers

0
votes

I am not sure if this will work but, Have you installed the XLL library in your computer?