'Encoding issue with Shiny App and RStudio

I am having a problem at the time of publishing a Shiny app created in RStudio. Locally it works great, but at the time of publishing, i am getting the following error:

Preparing to deploy application...DONE
Uploading bundle for application: 6271509...Detecting system locale ... DONE
Deploying bundle: 5891038 for application: 6271509 ...
Waiting for task: 1150562680
  building: Building image: 6880241
  building: Installing packages
  building: Installing files
  building: Pushing image: 6880241
  deploying: Starting instances
  success: Stopping old instances
Application successfully deployed to https://victuol.shinyapps.io/CorresponsalesSingleApp/
Deployment completed: https://victuol.shinyapps.io/CorresponsalesSingleApp/
Warning message:
Error detecting locale: Error in read.table(file = file, header = header, sep = sep, quote = quote, : incomplete final line found by readTableHeader on 'raw'
 (Using default: en_US)

The following is my working code:

library(shiny)

library(DT)

setwd("C:/Users/Usuario/Desktop/Proyecto Shiny Corresponsales")

library("openxlsx")

df<-read.xlsx("Base Datos Corresponsales Bancolombia LIMPIO Hoja 3.xlsx", sheet = 3,colNames = TRUE,cols=c(1,2,3,4,5,6))

ui <- basicPage(
  
  tags$a(
    href="https://lotopunto.negocio.site/", 
    tags$img(src = "Logo Loto Punto PNG.png", height = 260, width = 320, title = "Loto Punto Corresponsal Bancario")
      ),
  h2(strong("Paga, Juega y Recarga. ¡Todo aquí!")),
  h1("Mapa de Corresponsales Bancarios Bancolombia"),
  h3("Digita en la celda 'Search', la ciudad donde estás ubicado. 
  Se desplegarán los Corresponsales Bancarios Bancolombia disponibles"),
  
  
  DT::dataTableOutput("mytable")
)

server <- function(input, output) {
  output$mytable = DT::renderDataTable({
    df
  
    })
}

# Run the application
shinyApp(ui, server)

I am using an excel table, which have characters in Spanish (e.g. "'"). Might this be the problem? How can this be fixed? Please provide an example of the solution.



Solution 1:[1]

Solved! All i had to do was to eliminate the following line:

setwd("C:/Users/Usuario/Desktop/Proyecto Shiny Corresponsales")

I tried this solution, written at this post: https://groups.google.com/g/shinyapps-users/c/Fuh74H78G4s

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 user3736295