gpt4 book ai didi

r - R-Shiny 应用程序中的重音标记

转载 作者:行者123 更新时间:2023-12-05 03:06:11 26 4
gpt4 key购买 nike

我是 shiny 的新手,我正在尝试输入 html 标签以添加一些标题文本,但包含重音符号的单词(在西类牙语中很常见)会导致错误。例如,下面的代码产生了我想要的结果:

library(shiny)
ui <- fluidPage(

titlePanel("Titles"),
sidebarLayout(
sidebarPanel(
tagList(tags$h4("Geological Survey of Colombia"),
tags$h2("Analitic Geochemistry Group"),
tags$p("Text here"))),

# Main panel for displaying outputs ----
mainPanel()
)
)
server <- function(input, output) {}
shinyApp(ui, server)

但是将 tags$h4("Geological Survey of Colombia") 更改为 tags$h4("Servicio Geológico Colombiano") 会导致错误:

 Warning in checkEncoding(file) :   The input file
C:\Users\cparedes\Documents\Shiny\test/app.R does not seem to be
encoded in UTF8 Warning in readLines(file, warn = FALSE) : invalid
input found on input connection
'C:\Users\cparedes\Documents\Shiny\test/app.R' Error in parse(file,
keep.source = FALSE, srcfile = src, encoding = enc) :
C:\Users\cparedes\Documents\Shiny\test/app.R:7:25: unexpected
INCOMPLETE_STRING 6: sidebarPanel( 7:
tagList(tags$h4("Servicio Geol
^ Error in sourceUTF8(fullpath, envir = new.env(parent = globalenv())) : Error sourcing
C:\Users\cparedes\AppData\Local\Temp\RtmpOwSrGa\file132427ca68ec

如何包含重音符号?

最佳答案

您可以通过“使用编码保存”您的文件以 UTF-8 格式解决此问题。我在重音符号方面遇到了同样的问题,并使用了本指南 https://shiny.rstudio.com/articles/unicode.html

关于r - R-Shiny 应用程序中的重音标记,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49805017/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com