从这个问题继续。我想修改结果的列宽,但不使用kableExtra. 如果我加载kableExtra包,图像将成为文本格式。
这是代码:
---
title: "Untitled"
output:
pdf_document:
latex_engine: xelatex
---
```{r echo=FALSE, results='hide', warning=FALSE, message=FALSE}
## Load modules
library(dplyr)
library(tidyr)
library(ggplot2)
options(tinytex.verbose = TRUE)
## Create a local function to plot the z score
varianceChart <- function(df, personNumber) {
plot <- df %>%
filter(n == personNumber) %>%
ggplot() +
aes(x=zscore, y=0) +
geom_rect(aes(xmin=-3.32, xmax=-1.96, ymin=-1, ymax=1), fill="orange2", alpha=0.8) +
geom_rect(aes(xmin=1.96, xmax=3.32, ymin=-1, ymax=1), fill="olivedrab3", alpha=0.8) +
geom_rect(aes(xmin=min(-4, zscore), xmax=-3.32, ymin=-1, ymax=1), fill="orangered3") + …Run Code Online (Sandbox Code Playgroud)