【发布时间】:2015-10-29 22:59:33
【问题描述】:
我的闪亮用户!我无法在我的 Shiny 表输出中呈现希腊字母。请注意,我确实知道如何使用 HTML 函数在 Shiny 中打印希腊字母。参见下面的代码 sn-ps。
这是 ui.R:
library(shiny)
shinyUI(pageWithSidebar(
headerPanel("A sample"),
sidebarPanel(
numericInput(
inputId = "alpha",
label = HTML("α:"),
value = 0.05,
step = 0.01
)
),
mainPanel(
plotOutput("samplePlot")
)
))
这是 server.R:
shinyServer(function(input, output) {
output$samplePlot <- renderPlot({
hist(c(1:100), main = "A Sample Plot", xlab = "Whatever")
})
})
这很好用,并在滑块中给了我一个希腊字母。但是,我也希望在我的表格输出中包含希腊字母,但类似的方法似乎不起作用......请参阅下面的代码。
这是 ui.R:
library(shiny)
shinyUI(pageWithSidebar(
headerPanel("A sample"),
sidebarPanel(
numericInput(
inputId = "alpha",
label = HTML("α:"),
value = 0.05,
step = 0.01
)
),
mainPanel(
plotOutput("samplePlot"),
tableOutput("myTable")
)
))
这是 server.R:
shinyServer(function(input, output) {
output$samplePlot <- renderPlot({
hist(c(1:100), main = "A Sample Plot", xlab = "Whatever")
})
output$myTable <- renderTable({
data.frame(alpha = HTML("α:"), value = 3)
})
})
关于如何在表格输出的 alpha 列中打印出希腊字母的任何想法。感谢任何帮助!
【问题讨论】: