如何在R-markdown中调整renderPrint的显示宽度

我正在使用一些R闪亮组件编写交互式R-markdown报告,以显示一些探索性分析结果。

我使用renderPrint()来显示来自describe()的结果,如下所示。

renderPrint({
    check_list <- c("CustomerSatisfaction","AssignedServiceFamily","ProductName","ReportedSource")
    df_overview <- df[check_list]%>%
                 subset(ReportedSource %in% input$select0) %>%
                 subset(AssignedServiceFamily %in% input$select1) %>% 
                 subset(ProductName %in% input$select2)
    describe(df_overview)
})

CustomerSatisfaction 是一个具有5个不同值的字符变量。但是,r markdown输出不能在同一行上显示所有5个值,尽管页面宽度上仍有一些剩余空间,如下面的屏幕快照所示。

如何在R-markdown中调整renderPrint的显示宽度

我试图通过如下设置选项来增加文件宽度。虽然降价输出的宽度相应增加,但renderPrint()仍分两部分显示我的 CustomerSatisfaction 的结果。仅灰色背景区域的宽度增加。

<style>
    body .main-container {
        max-width: 1200px;
    }
</style>

我还尝试如下设置renderPrint()的width选项,但对我来说不起作用。

renderPrint({mycode},width = 800)

有什么想法可以设置成如下所示的一部分?

如何在R-markdown中调整renderPrint的显示宽度

我的YAML标头设置如下。

---
title: "Title"
author: "Author"
date: "`r format(Sys.time(),'%Y-%m-%d')`"
output: html_document
theme: cosmo
runtime: shiny
---
mengyingyu2009 回答:如何在R-markdown中调整renderPrint的显示宽度

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3155418.html

大家都在问