R 在一行中使用超过12列
我是一个闪亮的新手,所以我的问题可能很简单,但在stackoverflow.com上找不到其他人提出类似的问题。 我需要建立一个应用程序超过12列。 所以我的问题是,我怎么能在同一行上有12个以上的textInput元素,并使它们的宽度稍微窄一点? 这是我的示例代码R 在一行中使用超过12列,r,shiny,R,Shiny,我是一个闪亮的新手,所以我的问题可能很简单,但在stackoverflow.com上找不到其他人提出类似的问题。 我需要建立一个应用程序超过12列。 所以我的问题是,我怎么能在同一行上有12个以上的textInput元素,并使它们的宽度稍微窄一点? 这是我的示例代码 library(shiny) u <- fluidPage( titlePanel("Simple Selectable Reactive Function"), sidebarLayout( s
library(shiny)
u <- fluidPage(
titlePanel("Simple Selectable Reactive Function"),
sidebarLayout(
sidebarPanel(),
mainPanel(
h2("Results"),
fluidRow(column(1,
textInput("input_ID", label = "text 1",
value = "123")),
column(1,
textInput("input_ID", label = "text 2",
value = "123")),
column(1,
textInput("input_ID", label = "text 3",
value = "123")),
column(1,
textInput("input_ID", label = "text 4",
value = "123")),
column(1,
textInput("input_ID", label = "text 5",
value = "123")),
column(1,
textInput("input_ID", label = "text 6",
value = "123")),
column(1,
textInput("input_ID", label = "text 7",
value = "123")),
column(1,
textInput("input_ID", label = "text 8",
value = "123")),
column(1,
textInput("input_ID", label = "text 9",
value = "123")),
column(1,
textInput("input_ID", label = "text 10",
value = "123")),
column(1,
textInput("input_ID", label = "text 11",
value = "123")),
column(1,
textInput("input_ID", label = "text Inp 12",
value = "123")),
column(1,
textInput("input_ID", label = "text Inp 13",
value = "123"))
)
)
)
)
s <- function(input,output){}
shinyApp(ui=u,server=s)
库(闪亮)
u您可以在列中再次使用fluidRow
。
最后的列
再次分为两列
library(shiny)
u <- fluidPage(
titlePanel("Simple Selectable Reactive Function"),
sidebarLayout(
sidebarPanel(),
mainPanel(
h2("Results"),
fluidRow(
column(1,
textInput("input_ID", label = "text 1",
value = "123")),
column(1,
textInput("input_ID", label = "text 2",
value = "123")),
column(1,
textInput("input_ID", label = "text 3",
value = "123")),
column(1,
textInput("input_ID", label = "text 4",
value = "123")),
column(1,
textInput("input_ID", label = "text 5",
value = "123")),
column(1,
textInput("input_ID", label = "text 6",
value = "123")),
column(1,
textInput("input_ID", label = "text 7",
value = "123")),
column(1,
textInput("input_ID", label = "text 8",
value = "123")),
column(1,
textInput("input_ID", label = "text 9",
value = "123")),
column(1,
textInput("input_ID", label = "text 10",
value = "123")),
column(1,
textInput("input_ID", label = "text 11",
value = "123")),
column(1, fluidRow(column(6,
textInput("input_ID", label = "text 12",
value = "123")),
column(6,
textInput("input_ID", label = "text 13",
value = "123"))))
)
)
)
)
s <- function(input,output){}
shinyApp(ui=u,server=s)
库(闪亮)
u闪亮的布局功能是建立在12列行想法的基础之上的。一行中可以有12个以上的列元素,但这些元素将换行到下面的行中。更多信息,请看这个。我明白了。是否有办法更改此默认值并使用tigher列或使用不同的代码而不是“列”?我在这里看到了一个解决方案,一个人在展示如何使用风格,但说实话,我不知道如何将它应用到我的案例中。我不知道如何做到这一点。引导的主要思想是查看设备的灵活性。元素的大小与设备相关,并相应地重新分布,因此它们很容易看到,例如,在ipad上,1行2列的2列是6列,在手机上是4行3列。您不需要使用fluidRow
s:您只需使用div
和CSS手动创建列即可。这会让你很痛苦,但如果你需要的话,这是一个选择。