Error with readxl package when trying to deploy app

Hello, I'm trying to deploy a little app to my shinyapps.io but I get this Error Message at the end

Not sure what to do!!

My app starts with this

library(readxl)
library(tidyverse)
library(here)
library(ggplot2)
library(shiny)

Datos <- read_excel(here("Data", "Datos.xlsx"))

I don't know if something is wrong there. Please, any help!

Thanks.

I got a message with the problem when I try to open the file with the Data. Here it´s a screen capture

The path in line 6 is the project directory, so I really don´t know what to do.

Thank you for any help.

You shouldn't use absolute paths when working on Shiny apps you have to use relative paths instead (relative to your apps root folder), this is because when deployed on a server the app doesn't has access to your local files anymore.

Thank you.

I did it. Relative paths, that's all!!!

I upload my app to shinyapp.io but every time I run it I get the same message.

I went to my logs, this is a screen for it.

When the deply process ends, I get this message in the deploy tab in RStudio.

I'm not sure what is that "Failed to parse..."

Thanks again for your help.

Can you post your actual code (not an screenshot)?

This is it:

library(readxl)
library(tidyverse)
library(ggplot2)
library(shiny)

Datos <- read_excel("Datos.xlsx")

Datos$DIA <- as.factor(Datos$DIA)

ui <- fluidPage(titlePanel = "Gráfica Energía",
                fluidRow(sidebarLayout(
                    sidebarPanel(
                        helpText("Seleccionar el año y mes que se desea observar"),
                        selectInput("Año", h3("Año"),
                                    choices = list("2014"=2014, "2015"=2015, "2016"=2016, "2017"=2017,
                                                   "2018"=2018, "2019"=2019, "2020"=2020)),
                        selectInput("Mes", h3("Mes"),
                                    choices = list("Enero"=1, "Febrero"=2, "Marzo"=3,
                                                   "Abril"=4, "Mayo"=5, "Junio"=6,
                                                   "Julio"=7, "Agosto"=8, "Septiembre"=9,
                                                   "Octubre"=10, "Noviembre"=11, "Diciembre"=12))
                    ),
                    mainPanel(
                        plotOutput("Grafico_Linea")
                    )
                ),
                fluidRow(mainPanel(
                    plotOutput("Grafico_Box")
                ))
                )
)


server <- function(input, output) {
    output$Grafico_Linea <- renderPlot({
        Datos %>%
            filter(AÑO == input$Año, MES == input$Mes) %>%
            ggplot() +
            geom_line(aes(x = hora, y = VILLRAGU01, color = DIA), size = 1) +
            labs(x = "Hora", y = "Energía [MWh]") +
            scale_y_continuous(breaks = seq(0,25,5)) +
            scale_x_continuous(breaks = seq(0,24,1)) +
            theme_bw()
    })
    output$Grafico_Box <- renderPlot({
        Datos %>%
            filter(AÑO == input$Año, MES == input$Mes) %>%
            ggplot() +
            geom_boxplot(aes(x = DIA, y = VILLRAGU01, color = DIA)) +
            labs(x = "Día", y = "Energía [MWh]") +
            scale_y_continuous(breaks = seq(0,25,5)) +
            theme_bw()
    })
}


shinyApp(ui = ui, server = server)

After some reasearch through the internet, I found a lot of solutions that never worked for me.

Finally, I found a similar post to this where it was mentioned that especial characters weren´t recognize by shinyapp. And that´s true!!

In my dataset I had one variable with a name with "Ñ" and one of my declare inputs had a name with "ñ" (Both are related in the app). I changed the name of both variables for their translation in english.

And that´s all!!. Now my app deployed without problems and it´s working.

I hope this helps to anybody else.

Maybe this could help also

Thanks @andresrcs, with the setting options(encoding = "UTF-8") I didn't need to change the name of my variables.

I forgot to tell that I also realized two things:

  1. I was installing my packages in a personal directory, so shiny wasn't able to find them.
  2. I needed superuser permissions so I could install the packages with install.packages("pkgname", lib = .Library) without superuser permissions I was getting the message "path unwritable"

After this, shinyapp was able to find the packages. That's all.

Thanks again.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.