知道为什么侧面板中的滑块和下拉选项不在同一行上吗?
require(shiny)
ui <- fluidPage(
titlePanel("problem"),
sidebarLayout(
sidebarPanel(width = 4,
textInput(inputId = 'input', label = 'input'),
tabsetPanel(
tabPanel("panel 1",
br(),
fluidRow(
sliderInput('smooth', 'Smooth', 0, 5, 3, step = 1, width='20%'),
selectInput("option", "Choose a option", choices = c("option 1", "option 2"), width='40%')
)
, width='100%'),
tabPanel("panel 2", verbatimTextOutput("summary"))
)
),
mainPanel(width = 8, p('main panel'))
)
)
server <- function(input, output){}
shinyApp(ui, server)
答案 0 :(得分:3)
fluidRow
将需要定义column
以根据需要显示布局。在你的情况下,以下工作:
fluidRow(
column(4,
sliderInput('smooth', 'Smooth', 0, 5, 3, step = 1)
),
column(4,
selectInput("option", "Choose a option", choices = c("option 1", "option 2"))
)
)
column(4,
是每列的宽度。
答案 1 :(得分:1)
这是你想要的吗?
require(shiny)
ui <- fluidPage(
titlePanel("problem"),
sidebarLayout(
sidebarPanel(width = 4,
textInput(inputId = 'input', label = 'input'),
tabsetPanel(
tabPanel("panel 1",
br(),
fluidRow(
div(style="display: inline-block;vertical-align:top; width: 49%;",sliderInput('smooth', 'Smooth', 0, 5, 3, step = 1)),
div(style="display: inline-block;vertical-align:top; width: 49%;",selectInput("option", "Choose a option", choices = c("option 1", "option 2")))
)
, width='100%'),
tabPanel("panel 2", verbatimTextOutput("summary"))
)
),
mainPanel(width = 8, p('main panel'))
)
)
server <- function(input, output){}
shinyApp(ui, server)