Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/83.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在闪亮的选项卡面板上呈现HTML_Html_R_Shiny_Summarytools - Fatal编程技术网

在闪亮的选项卡面板上呈现HTML

在闪亮的选项卡面板上呈现HTML,html,r,shiny,summarytools,Html,R,Shiny,Summarytools,HTML输出由summarytool::dfSummary函数创建 summarytools使用Bootstrap的样式表生成独立的HTML文档,这些文档可以使用generic print()函数显示在Web浏览器或RStudio的查看器中 当HTML在选项卡面板上呈现时,整个UI都会改变。有没有一种方法可以在不改变UI的情况下在tabpanel上呈现HTML library(summarytools) ui <- fluidPage( titlePanel("dfSummary"

HTML输出由summarytool::dfSummary函数创建

summarytools使用Bootstrap的样式表生成独立的HTML文档,这些文档可以使用generic print()函数显示在Web浏览器或RStudio的查看器中

当HTML在选项卡面板上呈现时,整个UI都会改变。有没有一种方法可以在不改变UI的情况下在tabpanel上呈现HTML

library(summarytools)

ui <- fluidPage(
  titlePanel("dfSummary"),
  sidebarLayout(
    sidebarPanel(
      uiOutput("dfSummaryButton")
    ),
    mainPanel(
      tabsetPanel(
        tabPanel("Data Input",
         dataTableOutput("dataInput"),
         br(),
         verbatimTextOutput("profileSTR")),
        tabPanel("dfSummary Output",
         htmlOutput("profileSummary")))
    )
  )
)
server <- function(input, output, session) {
#Read in data file
recVal <- reactiveValues()
dfdata <- iris

#First 10 records of input file
output$dataInput <- renderDataTable(head(dfdata, n = 10), options = list(scrollY = '500px', 
                          scrollX = TRUE, searching = FALSE, paging = FALSE, info = FALSE, 
                          ordering = FALSE, columnDefs = list(list(className = 'dt-center', 
                          targets = '_all'))))

#str() of input file
output$profileSTR <- renderPrint({
  ProStr <- str(dfdata)
  return(ProStr) 
})

#Create dfSummary Button
output$dfSummaryButton <- renderUI({
      actionButton("dfsummarybutton", "Create dfSummary")
    })

### Apply dfSummary Buttom
observeEvent(input$dfsummarybutton, {
  recVal$dfdata <- dfdata
})

#dfSummary data
output$profileSummary <- renderUI({
       req(recVal$dfdata)
       SumProfile <- print(dfSummary(recVal$dfdata), omit.headings = TRUE, method = 'render')
       SumProfile
})
}
shinyApp(ui, server)
库(摘要工具)

summarytools的ui0.8.3版有一个新的布尔选项,
bootstrap.css
,可以防止这种情况发生。另外,
graph.magnize
允许调整图形的大小

SumProfile <- print(dfSummary(recVal$dfdata), 
                    method = 'render',
                    omit.headings = TRUE,
                    footnote = NA,
                    bootstrap.css = FALSE,
                    graph.magnif = 0.8)
SumProfile