我目前正在RStudio中使用markdown进行投影仪演示。我有一些代码块可以生成输出,我想以某种方式格式化输出。这是一张幻灯片:
---
title: "An Introduction to Statistical Analysis with R"
author: Me
date: Now
output:
beamer_presentation:
slide_level: 3
---
# Lecture 2: Creating datasets with R
### Assignments
R, like other computer languages, has *symbolic variables*, that is
names that can be used to represent values. To assign the value 2 to the
variable `x` and then work with it, you can enter
```{r, collapse=TRUE}
x <- 2
x
x+x
2*x+exp(x)
2*x*pi
```
当前,PDF文件中代码块的输出如下:
x <- 2
x
## [1] 2
x+x
## [1] 4
2*x+exp(x)
## [1] 11.38906
2*x*pi
## [1] 12.56637
我想更改生成的输出的字体和颜色(即散列线)。我还想将代码的输出空间隔开,所以看起来像这样:
x <- 2
x
## [1] 2
x+x
## [1] 4
2*x+exp(x)
## [1] 11.38906
2*x*pi
## [1] 12.56637
我该如何实现?我不太喜欢knitr(尤其是语法)。从目前为止我所读到的内容中,钩子可能有用吗?我也想在全球范围内实施建议的更改。