您是否考虑过直接呈现为 HTML?然后,如果您需要 HTML 之外的静态副本,则可以从 Web 浏览器打印到 pdf。 Rmarkdown 可以很好地处理这两种文件类型,让您更轻松地创建自定义报告。
---
title: "Rmarkdown report"
output: html_document
---
##
**First:** John   **First:** Smith <br>
**Age:** 12   **Sport:** Football <br>
**submission** <br>
Space colonists, like people on Earth, will need what are known as rare earth elements, which are critical to modern technologies. These 17 elements, with daunting names like yttrium, lanthanum, neodymium and gadolinium, are sparsely distributed in the Earth’s crust. Without the rare earths, we wouldn’t have certain lasers, metallic alloys and powerful magnets that are used in cellphones and electric cars.", "But mining them on Earth today is an arduous process. It requires crushing tons of ore and then extracting smidgens of these metals using chemicals that leave behind rivers of toxic waste water.
***
**First:** John   **First:** Smith <br>
**Age:** 12   **Sport:** Football <br>
**submission** <br>
Space colonists, like people on Earth, will need what are known as rare earth elements, which are critical to modern technologies. These 17 elements, with daunting names like yttrium, lanthanum, neodymium and gadolinium, are sparsely distributed in the Earth’s crust. Without the rare earths, we wouldn’t have certain lasers, metallic alloys and powerful magnets that are used in cellphones and electric cars.", "But mining them on Earth today is an arduous process. It requires crushing tons of ore and then extracting smidgens of these metals using chemicals that leave behind rivers of toxic waste water.
但是,如果您想为 .csv 文件编制索引,您可以使用索引和内联 R 代码在 Rmarkdown 中直接调用它。但为简单起见,我不得不编辑 .csv 的提交部分,因为我遇到了语法问题。
---
title: "Rmarkdown report"
output: html_document
---
```{r echo = FALSE}
data <- data.frame(First = c("John", "Hui", "Jared"), Second = c("Smith", "Chang", "Jzu"), Sport = c("Football","Soccer","Ballet"), Age = c("12", "13", "12"), submission = c("Microbes may be the friends of future colonists living off the land on the moon, Mars or elsewhere in the solar system and aiming to establish self-sufficient homes. Space colonists, like people on Earth, will need what are known as rare earth elements, which are critical to modern technologies. These 17 elements, with daunting names like yttrium, lanthanum, neodymium and gadolinium, are sparsely distributed in the Earths crust. Without the rare earths, we wouldn’t have certain lasers, metallic alloys and powerful magnets that are used in cellphones and electric cars. But mining them on Earth today is an arduous process. It requires crushing tons of ore and then extracting smidgens of these metals using chemicals that leave behind rivers of toxic waste water.",
"Experiments conducted aboard the International Space Station show that a potentially cleaner, more efficient method could work on other worlds: let bacteria do the messy work of separating rare earth elements from rock. The idea is the biology is essentially catalyzing a reaction that would occur very slowly without the biology, said Charles S. Cockell, a professor of astrobiology at the University of Edinburgh.
On Earth, such biomining techniques are already used to produce 10 to 20 percent of the world’s copper and also at some gold mines; scientists have identified microbes that help leach rare earth elements out of rocks.",
"Experiments conducted aboard the International Space Station show that a potentially cleaner, more efficient method could work on other worlds: let bacteria do the messy work of separating rare earth elements from rock. The idea is the biology is essentially catalyzing a reaction that would occur very slowly without the biology, said Charles S. Cockell, a professor of astrobiology at the University of Edinburgh.
On Earth, such biomining techniques are already used to produce 10 to 20 percent of the world’s copper and also at some gold mines; scientists have identified microbes that help leach rare earth elements out of rocks."))
```
##
**First:** `r data[1,1]`   **First:** `r data[1,2]` <br>
**Age:** `r data[1,"Age"]`   **Sport:** `r data[1,"Sport"]` <br>
**submission** <br>
`r data[[5]][2]`
***
**First:** `r data[2,1]`   **First:** `r data[2,2]` <br>
**Age:** `r data[2,"Age"]`   **Sport:** `r data[2,"Sport"]` <br>
**submission** <br>
`r data[[5]][1]`
这为我们提供了与您在索引 .csv 时要求的类似输出