我试图将renderText元素的形式放在textOutput标头旁边,但它始终将它们放在不同的行上。
h1('This is the number:'), textOutput(output$number)
这也不起作用:
p(h1('This is the number:'), textOutput(output$number))
任何人都可以解决吗?
Bat*_*hek 10
你可以用css来做
ui=shinyUI(fluidPage(
tags$head(tags$style("
#number{
display:inline
}")),
h1('This is the number:',style="display:inline"), textOutput("number")
)
)
server=function(input,output){
output$number=renderText({5})
}
shinyApp(ui,server)
Run Code Online (Sandbox Code Playgroud)
或者
ui=shinyUI(fluidPage(
tags$head(tags$style("
#container * {
display: inline;
}")),
div(id="container",h1('This is the number:'), textOutput("number"))
)
)
Run Code Online (Sandbox Code Playgroud)
在server.R中构造所有内容
output$textWithNumber <- renderText({
paste("This is the number:", yourNumber)
})
Run Code Online (Sandbox Code Playgroud)
然后在ui.R中
h1(textOutput("textWithNumber"))
Run Code Online (Sandbox Code Playgroud)