如何在Shiny的用户界面中添加页脚注释或免责声明?这是我目前的布局,
shinyUI(
pageWithSidebar(
headerPanel("My Title"),
sidebarPanel("sidebar"),
mainPanel("hello world")
)
)
Run Code Online (Sandbox Code Playgroud)
我已经检查了这个页面,但没有提到这个.有任何想法吗?
我需要的是,
My Title
sidebar hello world (plots)
----------------------------
disclaimer
Run Code Online (Sandbox Code Playgroud)
以下是其他Shiny快乐人士使用的示例.
请注意,我已将上述示例更新sidebarLayout为?pageWithSidebar帮助状态:
pageWithSidebar - 不推荐使用此函数.您应该使用fluidPage和sidebarLayout来实现带有侧边栏的页面.
页脚的基本示例
我已经在一个app.r样式中做了一个示例,所以人们可以测试这个,但如果你有一个ui.R文件,只需在你的fluidPage通话结束前添加一行.我在页脚之前使用横向规则(hr)使页脚突出,但这取决于你.我注意到navbarPage你可以设置页眉和页脚参数.
# app.R
library(shiny)
ui<- shinyUI(
fluidPage(title = "Footer example App",
sidebarLayout(sidebarPanel("sidebar",
selectInput("pet", "Pet",
c("Cat", "Dog", "Fish"))
),
mainPanel("hello world")
),
# WHERE YOUR FOOTER GOES
hr(),
print("~~~my disclaimer~~~~")
)
)
server <- function(input, output) {
# empty for minimal example
}
shinyApp(ui=ui, server = server)
Run Code Online (Sandbox Code Playgroud)
结果
使用footer.html更高级
我有自己的带有CSS和徽标样式的footer.html文件.将footer.html文件放在与闪亮文件相同的位置并使用includeHTML.我用div包装,所以任何css都被拿起来.
在上面的例子中,替换行:
print("~~~my disclaimer~~~~")
Run Code Online (Sandbox Code Playgroud)
附:
div(class = "footer",
includeHTML("footer.html")
))
Run Code Online (Sandbox Code Playgroud)