我正在向Rmarkdown文档添加多个手册表。当我编织成HTML时,第一个之后的每个后续表都会缩进,逐渐增加。我a)不明白为什么会这样,并且b)非常希望它不会发生。
我尝试使用Pandoc的管道框架将表作为纯Rmarkdown文本输入。我尝试将管道框架Pandoc表放入R块中。目前,我正在使用tidyverse软件包中的tribble
函数,并通过kable
和kable_styling
进行格式化。
---
title: "2.2 EICRP Codebook"
date: "`r Sys.Date()`"
output:
html_notebook: default
word_document: default
---
knitr::opts_chunk$set(echo = FALSE)
if (!require(pacman)) {
install.packages("pacman", repos = "http://cran.us.r-project.org")
require(pacman)
}
p_load(here,
knitr,
kableExtra,
tidyverse)
rm(list = ls())
A.1。您如何以1到5的比例来描述您的环境行为和行为?
一些文本。
tribble(
~"QA01", ~"Value", ~"Label",
"01", "1", "Very Unsustainable",
"02", "2", "Unsustainable",
"03", "3", "Neither Sustainable nor Unsustainable",
"04", "4", "Sustainable",
"05", "5", "Very Sustainable"
) %>%
kable() %>%
kable_styling()
一些文本。
tribble(
~"QA02_01", ~"Value", ~"Label",
"01", "0", "No",
"02", "1", "Any Environmentally Sustainable Action"
) %>%
kable() %>%
kable_styling()
tribble(
~"QA02_02", ~"Value", ~"Label",
"01", "0", "No",
"02", "1", "Environmental Activism"
) %>%
kable() %>%
kable_styling()
tribble(
~"QA02_03", ~"Value", ~"Label",
"01", "0", "No",
"02", "1", "Neither"
) %>%
kable() %>%
kable_styling()
第二个代码块中的表带有附加的缩进格式。
更新:
我已经使用column_spec
函数实现了变通方法,但是我仍然想知道为什么会这样。