【问题标题】:Latex, RenderTable in Shiny, RLatex,RenderTable in Shiny,R
【发布时间】:2023-03-24 11:18:01
【问题描述】:

我只是想在 Shiny 的桌子上找到$\10^{-1}$,但它不起作用。我正在尝试以下代码(提前致谢):

ui.R

require(shiny)  
shinyUI(tableOutput('mytable') 
)

server.R

  require(shiny)  
shinyServer(function(input, output){  
output$mytable <- renderTable({  
df <- data.frame(A = c("$\\10^{-1}$", 33.1, 6),B = c(111111, 3333333, 3123.233))  
df  
  }, sanitize.text.function = function(x) x)
})

【问题讨论】:

    标签: r latex shiny


    【解决方案1】:

    您可以在闪亮中使用 mathJAX:

    require(shiny)  
    ui <- shinyUI(
      fluidPage(
        withMathJax()
        , h2("$$\\mbox{My Math example }\\sqrt{2}$$")
        , tableOutput('mytable')
        )
    )
    server <- function(input, output, session){  
      output$mytable <- renderTable({  
        df <- data.frame(A = c(HTML("$$\\alpha+\\beta$$"), 33.1, 6),B = c(111111, 3333333, 3123.233))  
        df  
      }, sanitize.text.function = function(x) x)
    }
    
    shinyApp(ui = ui, server = server)
    

    【讨论】:

    • 谢谢你 jdharrison!我刚刚意识到我使用的是 R-studio 浏览器,这导致了问题!
    • @user150272 如果这回答了您的问题,请考虑通过打勾将问题标记为已回答。
    猜你喜欢
    • 2021-08-04
    • 2021-02-11
    • 2014-01-07
    • 1970-01-01
    • 2023-04-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-08
    相关资源
    最近更新 更多