【问题标题】:Shiny: renderPrint a string without [1] and without escape charactersShiny:renderPrint 一个没有 [1] 且没有转义字符的字符串
【发布时间】:2021-02-11 13:56:47
【问题描述】:

如何在 Shiny S 中打印字符串 ...

  • 没有[1]
  • 没有开始和结束引号"
  • 并且没有转义字符?

示例

library("shiny")

# Define UI ----
ui <- fluidPage(
  
  mainPanel(
    verbatimTextOutput("showstring")
  )
)

# Define server logic ----
server <- function(input, output) {

  output$showstring <- renderPrint({
    
    mystring <- "DOI (\"10.3390/ijerph15010052\")"
    
    mystring
    
  })
}

# Run the app ----
shinyApp(ui = ui, server = server)

当前(坏)结果:

【问题讨论】:

  • 使用renderText 而不是renderPrint
  • 谢谢,Limey - 完美的解决方案。我很尴尬,因为回答似乎很简单。您应该将其作为回复发布,以便我可以将其标记为正确的,从而“关闭”问题(对于可能的其他用户)。 (但我知道we had this discussion before,而且你似乎并不那么热衷于获得虚拟积分!)

标签: r string shiny printing escaping


【解决方案1】:

答案(感谢 cmets 中的 Limey)是使用 renderText 而不是 renderPrint

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-10-18
    • 1970-01-01
    • 2023-03-08
    • 2022-01-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多