我在ShinyApp中使用renderPrint函数来显示计算结果。结果会在前面加上一个[1],[2]等。
有没有办法摆脱它?
另外,可以更改输出的字体吗?
发布于 2018-06-10 21:20:54
您可以使用renderText而不是renderPrint。或者也许withMathJax()也可以是一个选择?
对于应用程序的样式,有几种方法可以做到这一点。您可以阅读有关该here的内容。在下面的示例中,我将css直接包含在应用程序中。对于小的调整,这可能是最简单的方法,对于更复杂的应用程序,我会使用css文件,并将其包含在includeCSS("www/style.css")或tags$head(tags$style("www/style.css"))中。
library(shiny)
ui <- fluidPage(
tags$head(
tags$style(HTML("
#renderprint {
color: white;
background: blue;
font-family: 'Times New Roman', Times, serif;
font-size: 20px;
font-style: italic;
}
#rendertext {
color: blue;
background: orange;
font-family: 'Times New Roman', Times, serif;
font-size: 12px;
font-weight: bold;
}
#rendertext1 {
color: red;
background: yellow;
font-family: Arial, Helvetica, sans-serif;
font-size: 19px;
}
"))
),
verbatimTextOutput("renderprint"),
verbatimTextOutput("rendertext"),
textOutput("rendertext1")
)
server <- function(input, output, session) {
output$renderprint <- renderPrint({
print("This is a render Print output")
})
output$rendertext <- renderText({
"This is a render Text output - with verbatimTextOutput"
})
output$rendertext1 <- renderText({
"This is a render Text output - with textOutput"
})
}
shinyApp(ui, server)https://stackoverflow.com/questions/50781653
复制相似问题