Hi! I'm new at shiny. I'm trying to deploy my first App. It worwed perfectly on my computer (using R studio). But when depploying there seems to be a strange problem with dependencies. Particularly, the deployed app shows the following error message
An error has occurred
The application failed to start: exited unexpectedly with code 1
Error in value[[3L]](cond) : there is no package called ‘tidyverse’ Calls: local ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous> Ejecución interrumpida
There is nothing evident there to me, maybe if we take a look at the actual code? Also, have you tried deleting the existing app and redeploying (so any cached data is cleared)? Some times when there is a package update in CRAN the RStudio's package Manager takes a couple days to catch up with the precompiled binaries for it.
Preparing to deploy application...
Update application currently deployed at https://cvfh.shinyapps.io/shiny_debates_latamv3/? [Y/n] y
DONE
Uploading bundle for application: 4583654...DONE
Deploying bundle: 5000160 for application: 4583654 ...
Waiting for task: 1003572354
building: Processing bundle: 5000160
building: Building image: 5729733
building: Installing packages
building: Installing files
building: Pushing image: 5729733
deploying: Starting instances
rollforward: Activating new instances
unstaging: Stopping old instances
Application successfully deployed to https://cvfh.shinyapps.io/shiny_debates_latamv3/
Warning message:
In fileDependencies.R(file) :
Failed to parse C:/Users/carof/AppData/Local/Temp/RtmpucBObq/file330c1b287cf9/app.R ; dependencies in this file will not be discovered.
I'll try what you suggest. thou I'm now definetively convinced there's a problem with the uploading / using of the files. In the demo I tried, I had no problem with tidyverse nor with introducing a first database. But when I try to use any second database, parsing fails. What should I do to manage more than one database?
(this is the code I'm experimenting with. I'm "#" each data line at a time:)
#
# This is a Shiny web application. You can run the application by clicking
# the 'Run App' button above.
#
# Find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com/
#
library(shiny)
library(tidyverse)
data <- read.csv("base.csv", stringsAsFactors = F)
#base_años <- read.csv("base_anos.csv", stringsAsFactors = F)
#base_organizadores <- read.csv("base_organizadores.csv", stringsAsFactors = F)
#base_formatos <- read.csv("base_formatos.csv", stringsAsFactors = F)
#base_temas <- read.csv("base_temas.csv", stringsAsFactors = F)
#base_normativa <- read.csv("base_normativa.csv", stringsAsFactors = F)
codebook <- read.csv("codebook.csv", stringsAsFactors = F)
#base_cluster_pais <- read.csv("base_cluster_pais.csv", stringsAsFactors = F)
#codebook_cluster_pais <- read.csv("codebook_cluster_pais.csv", stringsAsFactors = F)
# Define UI for application that draws a histogram
ui <- fluidPage(
# Application title
titlePanel("Old Faithful Geyser Data"),
# Sidebar with a slider input for number of bins
sidebarLayout(
sidebarPanel(
sliderInput("bins",
"Number of bins:",
min = 1,
max = 50,
value = 30)
),
# Show a plot of the generated distribution
mainPanel(
plotOutput("distPlot"),
tableOutput("disttable")
)
)
)
# Define server logic required to draw a histogram
server <- function(input, output) {
output$distPlot <- renderPlot({
# generate bins based on input$bins from ui.R
x <- data
binsi <- input$binsrsc
# draw the histogram with the specified number of bins
x %>%
ggplot() +
geom_histogram(aes(n_ausentes),
bins = binsi)
})
output$disttable <- renderTable({
codebook
})
}
# Run the application
shinyApp(ui = ui, server = server)
This suggests an encoding issue, maybe because of non-ASCII characters in your file (e. g. Spanish accents).
This sort of problem happens very often with shinyapps.io, one thing to try is setting options(encoding = "UTF-8") before deploying the app. If that doesn't work, try copying your code into a new file explicitly encoded as UTF8 from the beginning.
It worked! there were a few databases with strange characters (ie: accents and "ñ") inside colnames. I had to rename them manually . thank you very much again!
Just a small advice, do not refer to csv files as databases because it can't create confution, some people might assume you are talking about a database engine (e.g. Postgresql, MySQL, Microsoft SQL, etc) and not just a simple csv file.
Also, If your question's been answered (even by you!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it: