编写RMD文件时,有时会收到“警告消息”。
控制台消息,如下所示。
> library('gapminder')
Warning messages:
1: In res[i] <- withCallingHandlers(if (tangle) process_tangle(group) else process_group(group), :
number of items to replace is not a multiple of replacement length
2: In res[i] <- withCallingHandlers(if (tangle) process_tangle(group) else process_group(group), :
number of items to replace is not a multiple of replacement length
> gapminder[gapminder$country=='Afghanistan', c('pop','gdpPercap')]
Warning messages:
1: In res[i] <- withCallingHandlers(if (tangle) process_tangle(group) else process_group(group), :
number of items to replace is not a multiple of replacement length
...
奇怪的是,如果我创建一个R文件而不是RMD,则同一命令将不会输出警告消息。
所以我猜这条警告消息是由RMD引起的。
---
title: "test"
output:
html_document:
number_sections: true
toc: true
toc_depth: 6
toc_float: true
html_notebook:
number_sections: true
toc: true
toc_depth: 6
toc_float: true
---
```{r, eval=TRUE}
library('gapminder')
gapminder[gapminder$country=='Afghanistan', c('pop','gdpPercap')]
```