R 将两个块合并为一个块

R 将两个块合并为一个块,r,r-markdown,R,R Markdown,有时我不得不在R标记中生成更多的块来“伪造”R标记中的输出。举个例子,因为我发现通过调用常用的wordcloud2函数,在R标记中打印wordcloud2基本上是不可能的,所以我不得不在我的pdf上打印它,但让它看起来像是基本函数完成的 ```{r} freq <- data.frame(names(freq),freq, row.names = 1:length(freq)) library(wordcloud2) ``` ```{r eval=FAL

有时我不得不在R标记中生成更多的块来“伪造”R标记中的输出。举个例子,因为我发现通过调用常用的wordcloud2函数,在R标记中打印wordcloud2基本上是不可能的,所以我不得不在我的pdf上打印它,但让它看起来像是基本函数完成的

```{r}
freq <- data.frame(names(freq),freq, row.names 
                 = 1:length(freq))
library(wordcloud2)
```
```{r eval=FALSE}
wordcloud2(freq,color="random-light", backgroundColor = "grey")
```
```{r echo=FALSE, message=FALSE}
library(htmlwidgets)
webshot::install_phantomjs()
hw = wordcloud2(freq,color="random-light", backgroundColor = "grey")
saveWidget(hw,"1.html",selfcontained = F)
webshot::webshot("1.html","1.png",vwidth = 700, vheight = 500, delay =10)
```
`{r}

freq让整个第一个块“假”,然后复制需要运行到第二个块的部分如何

```{r eval = F}
freq <- data.frame(sample(LETTERS, 100, replace = T),
                   freq = sample(1:100, 100, replace = T),
                   row.names = 1:100)
library(wordcloud2)
wordcloud2(freq, color = "random-light", backgroundColor = "grey")
```

```{r echo = F, message = F}
freq <- data.frame(sample(LETTERS, 100, replace = T),
                   freq = sample(1:100, 100, replace = T),
                   row.names = 1:100)
library(wordcloud2)
library(htmlwidgets)
webshot::install_phantomjs()
hw = wordcloud2(freq, color = "random-light", backgroundColor = "grey")
saveWidget(hw, "1.html", selfcontained = F)
webshot::webshot("1.html", "1.png", vwidth = 700, vheight = 500, delay = 10)
```
`{r eval=F}

freq让整个第一个块“假”,然后复制需要运行到第二个块的部分如何

```{r eval = F}
freq <- data.frame(sample(LETTERS, 100, replace = T),
                   freq = sample(1:100, 100, replace = T),
                   row.names = 1:100)
library(wordcloud2)
wordcloud2(freq, color = "random-light", backgroundColor = "grey")
```

```{r echo = F, message = F}
freq <- data.frame(sample(LETTERS, 100, replace = T),
                   freq = sample(1:100, 100, replace = T),
                   row.names = 1:100)
library(wordcloud2)
library(htmlwidgets)
webshot::install_phantomjs()
hw = wordcloud2(freq, color = "random-light", backgroundColor = "grey")
saveWidget(hw, "1.html", selfcontained = F)
webshot::webshot("1.html", "1.png", vwidth = 700, vheight = 500, delay = 10)
```
`{r eval=F}
频率