如何将HTML表大小减小为屏幕大小RSHINY

时间:2019-09-11 09:22:59

标签: r shiny

如何减小输出的html表大小以自动适应屏幕大小,或者将其设置为较小但设置合理的大小。我正在使用daff应用程序比较文件,这些文件会作为抵押 这是我带有HTML表输出的闪亮应用程序

library("shiny")
library(daff)
library(dplyr)
library(shinythemes)
library("DT")

setwd("path")
ui = fluidPage(
  titlePanel("Automated Data Dictionary Comparison"),
  sidebarLayout(

    sidebarPanel(

      selectInput(inputId = 'Dic1',
                  label = 'Choose First Data Dictionary:',

                  choices = list.files(path = "./data",
                                       full.names = FALSE,
                                       recursive = FALSE)),
      selectInput(inputId = 'Dic2',
                  label = 'Choose Second Data Dictionary:',
                  choices = list.files(path = "./data",
                                       full.names = FALSE,
                                       recursive = FALSE))
    ),
    mainPanel (

      HTML("<div style ='overflow:auto; width:50%; height:50%' >"),
      uiOutput('contents'),
      HTML("</div>")

    )

)
)


server = function(input, output){    
  # Parse first file
  dataset1 <- reactive({

    infile <- input$Dic1

    if (is.null(infile)){
      return(NULL)
    }
    x <- read.csv(paste0("./data/", infile[[1]]))
    x
  })
  # Parse second file
  dataset2 <- reactive({
    infile <- input$Dic2

    if (is.null(infile)){
      return(NULL)
    }
    x <- read.csv(paste0("./data/", infile[[1]]))
    x
  })
  # Create comparison table (reactive as both of its elements are reactive)
  diff <- reactive({
    x <- render_diff(diff_data(data_ref=dataset1(), data=dataset2()),use.DataTables=TRUE)
    x
  })


  #Output
  output$contents <- renderUI({
    HTML(diff())

})
}
shinyApp(ui = ui, server = server)

我的闪亮应用正在输出一个非常大的扩展html表,我希望将其缩小以适合屏幕以提供更好的视图

0 个答案:

没有答案