Отображение очень большой таблицы сетки в R-Shiny

Я хочу отобразить большую таблицу сетки в Shiny, но не могу найти способ сделать это, так как Shiny, кажется, всегда усекает мою таблицу. Причина, по которой я использую таблицу сетки, заключается в том, что она предоставляет некоторые функции, которые мне нужно реализовать в моей таблице. Мне удалось отобразить вид справа налево, но вид сверху и снизу всегда усекается. Вот мой код:

ui:

library(shiny)
library(gridExtra)
library(grid)
library(gtable)

shinyUI(fluidPage(
mainPanel(
  div(class="double-scroll",style='overflow-x:scroll;overflow-y:scroll;
      height:1600px; width:1600px;',plotOutput("out"))
         )
       ))

сервер:

shinyServer(function(input, output,session) {
mat <- matrix(8,nrow=50,ncol=50)
example <- tableGrob(mat,rows=NULL,cols=NULL)
output$out <- renderPlot({grid.draw(example)})
             })

В этом примере отображаются 50 столбцов «8», но отображаются только 20 строк.


person arrow    schedule 14.02.2017    source источник


Ответы (1)


Попробуйте такой код:

 ui <- fluidPage(
     sidebarLayout(
     sidebarPanel(
          fileInput("file1", "Choose CSV File",
                accept = c("text/csv",
                "text/comma-separated-values,text/plain",
                ".csv")
    ),
    tags$hr(),
    checkboxInput("header", "Header", TRUE)
  ),
  mainPanel(
    tableOutput("contents")
  )
)
)

   server <- function(input, output) {
     output$contents <- renderTable({
     inFile <- input$file1
     if (is.null(inFile))
    return(NULL)
    df <- read.csv(inFile$datapath, header = input$header)
    print(df[,c(1:16)]) # display only the first 16th columns of your dataset
 })
}

shinyApp(ui, server)
person Alex Yahiaoui Martinez    schedule 02.06.2018