R 如何在屏幕中显示文本和表格
如何显示h3(“数值结果”)和h3(“汇总报表”)?多谢各位 这是我的ui.R和server.R 下面是我的ui.R文件的代码:R 如何在屏幕中显示文本和表格,r,shiny,R,Shiny,如何显示h3(“数值结果”)和h3(“汇总报表”)?多谢各位 这是我的ui.R和server.R 下面是我的ui.R文件的代码: library(shiny) ui <- shinyUI(fluidPage( titlePanel("aaaaaaaaaaaaaaaa"), tabsetPanel( navbarMenu("Means", tabPanel("One Mean"), tabPa
library(shiny)
ui <- shinyUI(fluidPage(
titlePanel("aaaaaaaaaaaaaaaa"),
tabsetPanel(
navbarMenu("Means",
tabPanel("One Mean"),
tabPanel("Two Means",
wellPanel(
checkboxInput(inputId = "s1", label = "S1" , value = FALSE),
checkboxInput(inputId = "s2", label = "S2", value = FALSE)
),
sidebarPanel(
p(strong("Error Rates")),
numericInput("alpha", label="Alpha", min=0, max=1,value=0.05),
numericInput("power", "Power", 0.8),
actionButton("submit","Submit")
),
mainPanel(
tabsetPanel(
tabPanel("Main",
tableOutput("Table"),
verbatimTextOutput("Text")
)
)
)
)
))))
库(闪亮)
ui对于表
,我猜您没有提供变量来存储/显示文本,对于文本
,粘贴
覆盖h3
代码。如果对粘贴的代码进行注释,则可以看到h3
代码。要有多行文本,可以尝试下面代码中的类似内容
library(shiny)
ui <- shinyUI(fluidPage(
titlePanel("aaaaaaaaaaaaaaaa"),
tabsetPanel(
navbarMenu("Means",
tabPanel("One Mean"),
tabPanel("Two Means",
wellPanel(
checkboxInput(inputId = "s1", label = "S1" , value = FALSE),
checkboxInput(inputId = "s2", label = "S2", value = FALSE)
),
sidebarPanel(
p(strong("Error Rates")),
numericInput("alpha", label="Alpha", min=0, max=1,value=0.05),
numericInput("power", "Power", 0.8),
actionButton("submit","Submit")
),
mainPanel(
tabsetPanel(
tabPanel("Main",
htmlOutput("header"),
tableOutput("Table"),
htmlOutput("Text")
)
)
)
)
))))
server <- shinyServer(function(input, output) {
output$header <- renderText({
if(input$submit > 0) {
HTML(paste0("<h3>","Numeric Results","</h3>"))
}
})
output$Table <- renderTable({
if(input$submit > 0) {
output<-data.frame(input$alpha,input$power)
output
}
})
output$Text<-renderPrint({
if(input$submit > 0) {
str1 <- (paste0("<h3>", "Summary Statements", "</h3>"))
str2 <- paste("alpha and power are",input$alpha,"and",input$power)
HTML(paste(str1, str2, sep = '<br/>'))
}
})
})
shinyApp(ui = ui, server = server)
库(闪亮)
用户界面
library(shiny)
ui <- shinyUI(fluidPage(
titlePanel("aaaaaaaaaaaaaaaa"),
tabsetPanel(
navbarMenu("Means",
tabPanel("One Mean"),
tabPanel("Two Means",
wellPanel(
checkboxInput(inputId = "s1", label = "S1" , value = FALSE),
checkboxInput(inputId = "s2", label = "S2", value = FALSE)
),
sidebarPanel(
p(strong("Error Rates")),
numericInput("alpha", label="Alpha", min=0, max=1,value=0.05),
numericInput("power", "Power", 0.8),
actionButton("submit","Submit")
),
mainPanel(
tabsetPanel(
tabPanel("Main",
htmlOutput("header"),
tableOutput("Table"),
htmlOutput("Text")
)
)
)
)
))))
server <- shinyServer(function(input, output) {
output$header <- renderText({
if(input$submit > 0) {
HTML(paste0("<h3>","Numeric Results","</h3>"))
}
})
output$Table <- renderTable({
if(input$submit > 0) {
output<-data.frame(input$alpha,input$power)
output
}
})
output$Text<-renderPrint({
if(input$submit > 0) {
str1 <- (paste0("<h3>", "Summary Statements", "</h3>"))
str2 <- paste("alpha and power are",input$alpha,"and",input$power)
HTML(paste(str1, str2, sep = '<br/>'))
}
})
})
shinyApp(ui = ui, server = server)