简体   繁体   English

Shiny App 和 RStudio 的编码问题

[英]Encoding issue with Shiny App and RStudio

I am having a problem at the time of publishing a Shiny app created in RStudio.我在发布在 RStudio 中创建的 Shiny 应用程序时遇到问题。 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 (eg "'").我正在使用一个 Excel 表,其中包含西班牙语字符(例如“'”)。 Might this be the problem?这可能是问题吗? How can this be fixed?如何解决这个问题? Please provide an example of the solution.请提供解决方案的示例。

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我尝试了这个解决方案,写在这篇文章中: https ://groups.google.com/g/shinyapps-users/c/Fuh74H78G4s

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM