目标:在Shiny App的列标题中使用数学符号。
例如,x-bar或beta,alpha等。
下面是我尝试过的结果,它会产生奇怪的结果(参见图片)。
我也尝试使用和表达式,这给出了这个错误: Warning: Error in as.data.frame.default: cannot coerce class ""expression"" to a data.frame
ui.R文件:
library(shiny)
shinyUI(pageWithSidebar(
headerPanel("Hello Shiny!"),
sidebarPanel(),
mainPanel(
tableOutput("mytable"),
tableOutput("mytable2")
)
))
server.R文件:
library(shiny)
shinyServer(function(input, output) {
mytable <- reactive({
iris2 <- iris
colnames(iris2) <- c("Sepal.Length", "Sepal.Width","$m^r_t$", "$\\delta p_t$","$R^r_t$")
})
output$mytable <- renderTable(head(iris,5))
output$mytable2 <- renderTable(mytable())
})
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句