gpt4 book ai didi

rpivotTable 不适合我的 Shiny Dashboard 页面

转载 作者:行者123 更新时间:2023-12-01 15:22:13 25 4
gpt4 key购买 nike

我在 Shiny 的仪表板中使用 rpivoTable 包。问题是我的表有接近 25 个变量(列),而我只能查看 10 列。其余部分不可见,也没有 slider 可以查看它们。

最好的,

最佳答案

我找到了一种方法——向该枢轴添加 css

tags$head(tags$style( type = 'text/css',  '#pivot{ overflow-x: scroll; }')),
rpivotTableOutput('pivot', width = "100%", height = "500px")

例如

用户界面

library(shiny)
library(rpivotTable)
library(shinydashboard)
shinyUI(dashboardPage(
dashboardHeader(title = "example"),
dashboardSidebar(disable = T),
dashboardBody(

tags$head(tags$style( type = 'text/css', '#pivot{ overflow-x: scroll; }')),
rpivotTableOutput('pivot', width = "100%", height = "500px")
)

))

服务器

df=data.frame(lapply(1:25,function(i)i=rnorm(20)))
colnames(df)=as.character(letters[1:25])

shinyServer(function(input, output,session) {

output$pivot <- renderRpivotTable({
rpivotTable(data = df)
})


})

关于rpivotTable 不适合我的 Shiny Dashboard 页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33951837/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com