5

单击分组类别附近的下拉箭头时,相应的列表将在页面顶部打开。(起初我认为它根本不起作用。)。正确的位置在箭头旁边,如图所示。

rmarkdown 可重现的例子:

---
title: "rpivottable_test"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

## R Markdown


`r stringi::stri_rand_lipsum(10)`


```{r cars}
library(rpivotTable)

data(mtcars)

```

## Including Plots

You can also embed plots, for example:

```{r pressure, echo=FALSE}
rpivotTable(mtcars,rows="gear", cols=c("cyl","carb"),width="100%", height="400px")
```

在此处输入图像描述 这是会话信息:

> sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19043)

Matrix products: default

locale:
[1] LC_COLLATE=Greek_Greece.1253 
[2] LC_CTYPE=Greek_Greece.1253   
[3] LC_MONETARY=Greek_Greece.1253
[4] LC_NUMERIC=C                 
[5] LC_TIME=Greek_Greece.1253    

attached base packages:
[1] stats     graphics  grDevices utils    
[5] datasets  methods   base     

other attached packages:
[1] rpivotTable_0.3.0

loaded via a namespace (and not attached):
[1] htmlwidgets_1.5.4 compiler_4.1.2   
[3] fastmap_1.1.0     htmltools_0.5.2  
[5] tools_4.1.2       knitr_1.36       
[7] digest_0.6.28     xfun_0.27        
[9] rlang_0.4.12 
4

1 回答 1

2

** WIP 答案,将在不再进行更新时删除。**

定义问题。

从目前所说的问题中并不完全清楚,但是有您可重现的示例(演示了不正确的视觉格式),然后是屏幕截图视觉(演示了正确的视觉风格)。

作为参考,正确的视觉风格来自这里的包小插图


TLDR - 一个有效的答案

解决方案的视觉证明

---
title: "rpivottable_test"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)

```

## R Markdown


`r stringi::stri_rand_lipsum(10)`


```{r cars, echo}
library(rpivotTable)

data(mtcars)

piv <- rpivotTable(mtcars,rows="gear", cols=c("cyl","carb"), elementId = "pvtTable")
htmlwidgets::saveWidget(piv, "pivot.html")
```

## Including Plots

You can also embed plots, for example:


## Answer

```{r pivot, echo=FALSE}
htmltools::includeHTML('pivot.html')
```

解释

  • 含糊地挥手*

所以,这就是我的不足之处,我并不真正理解为什么,因为从表面上看,到目前为止一切看起来都一样。

我调查的事情:

  • htmltools&的版本htmlwidgets
  • pvtUI& pvtFilterBoxdivs 和 css类
  • Rmarkdown/的html渲染选项knitr
  • 使用调用呈现文档并使用调用runtime: shiny包装RpivotTable定义renderRpivotTable({ })
  • elementId选项可能是因为 css 从一个意外的基本 elementId 中孤立了?
  • ??
  • 当前的工作理论 - Vignette 源代码行 907 中 Rmd 的无效样式标签被编织到示例 Rmd 中的链接中?

小插图源与 rmd 源

所以。如果您对 Knitr、html 或与上述相关的其他主题的下一步工作有任何想法,请发表评论!

于 2021-11-18T15:42:00.420 回答