我一直试图在我的闪亮应用程序中添加一些简单的mathjax表达式,但一直失败。 然后,我查看了一些在线示例,即使这些示例也无法在我的计算机上运行。 例如,我尝试从this question 运行代码,但mathjax表达式未显示。
library(shiny)
shinyApp(ui = shinyUI(fluidPage(sliderInput("order", withMathJax("Order, \\(k\\)"), min = 3, max = 7, value = 4, step = 1),
sliderInput("iknots", "iKnots", min = 0, max = 10, value = 5, step = 1),
uiOutput("lastSlider"))),
server = shinyServer(function(input, output, clientData, session) {
output$lastSlider<- renderUI({
k <- as.integer(input$order)
l <- as.integer(input$iknots)
sliderInput("xi1",label = withMathJax(paste0("\\(\\xi_{", k + l, "}\\)")), min = 0, max = 10, step = 0.1,value=input$xi1)
})
}))
您对此有何想法?
这是sessionInfo()
的输出:
R version 3.4.4 (2018-03-15)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
Matrix products: default
locale:
[1] LC_COLLATE=German_Austria.1252 LC_CTYPE=German_Austria.1252 LC_MONETARY=German_Austria.1252
[4] LC_NUMERIC=C LC_TIME=German_Austria.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] shiny_1.0.5
loaded via a namespace (and not attached):
[1] compiler_3.4.4 R6_2.2.2 htmltools_0.3.6 tools_3.4.4 yaml_2.1.16 Rcpp_0.12.16
[7] jsonlite_1.5 digest_0.6.13 xtable_1.8-2 httpuv_1.3.5 mime_0.5
谢谢。
答案 0 :(得分:0)
赞:
library(shiny)
shinyApp(
ui = shinyUI(
fluidPage(
withMathJax(),
sliderInput("order", "Order, \\(k\\)", min = 3, max = 7, value = 4, step = 1),
sliderInput("iknots", "iKnots", min = 0, max = 10, value = 5, step = 1),
uiOutput("lastSlider")
)
),
server = shinyServer(function(input, output, clientData, session) {
output$lastSlider<- renderUI({
k <- as.integer(input$order)
l <- as.integer(input$iknots)
tagList(
withMathJax(),
sliderInput("xi1", label = paste0("\\(\\xi_{", k + l, "}\\)"),
min = 0, max = 10, step = 0.1, value=input$xi1)
)
})
}))