我是闪亮的新手,正在尝试输入 html 标签来添加一些标题文本,但包含重音标记的单词(西班牙语中很常见)会导致错误。例如,下面的代码产生了我想要的结果:
\n\nlibrary(shiny)\nui <- fluidPage(\n\n titlePanel("Titles"),\n sidebarLayout(\n sidebarPanel( \n tagList(tags$h4("Geological Survey of Colombia"),\n tags$h2("Analitic Geochemistry Group"),\n tags$p("Text here"))),\n\n # Main panel for displaying outputs ----\n mainPanel()\n )\n )\nserver <- function(input, output) {}\nshinyApp(ui, server)\nRun Code Online (Sandbox Code Playgroud)\n\n但更改tags$h4("Geological Survey of Colombia")会tags$h4("Servicio Geol\xc3\xb3gico Colombiano")导致错误:
Warning in checkEncoding(file) : The input file\n C:\\Users\\cparedes\\Documents\\Shiny\\test/app.R does not seem to be\n encoded in UTF8 Warning in readLines(file, warn = FALSE) : invalid\n input found on input connection\n \'C:\\Users\\cparedes\\Documents\\Shiny\\test/app.R\' Error in parse(file,\n …Run Code Online (Sandbox Code Playgroud) 我正在编写我的第一个 R 包,目前正在研究一个使用某些特定图形参数绘制绘图的函数。我希望用户定义的图形参数在绘制完成后恢复,但总是收到相同的警告消息:
opar <- par()
par(oma = c(5, 4, 0, 0) + 0.1, mar = c(0, 0, 1, 1) + 0.1)
par(opar)
Run Code Online (Sandbox Code Playgroud)
警告消息:
1:在 par(opar) 中:无法设置图形参数“cin”
2:在 par(opar) 中:无法设置图形参数“cra”
3:在 par(opar) 中:无法设置图形参数“csi”设置
4:在 par(opar) 中:不能设置图形参数“cxy”
5:在 par(opar) 中:不能设置图形参数“din”
6:在 par(opar) 中:不能设置图形参数“page”
有没有更好的方法来做到这一点?我知道该suppressWarnings()函数,但 1. 我不希望消息被隐藏2. 如果该函数被调用两次,则会出现一条警告消息:
> There were 12 warnings (use warnings() to see them)
Run Code Online (Sandbox Code Playgroud)