R Markdownでknitrパッケージを使用して、HTMLレポートを作成しています。'+'を使用すると、コードを別々の行に保持するのに問題があります。
例えば、
```{r}
ggplot2(mydata, aes(x, y)) +
geom_point()
```
次のHTMLドキュメントを返します
ggplot2(mydata, aes(x, y)) + geom_point()
通常、これは問題ありませんが、追加の行を追加し始めると問題が発生します。コードをわかりやすくするために、行を分離しておく必要があります。以下を実行します。
```{r}
ggplot2(mydata, aes(x, y)) +
geom_point() +
geom_line() +
opts(panel.background = theme_rect(fill = "lightsteelblue2"),
panel.border = theme_rect(col = "grey"),
panel.grid.major = theme_line(col = "grey90"),
axis.ticks = theme_blank(),
axis.text.x = theme_text (size = 14, vjust = 0),
axis.text.y = theme_text (size = 14, hjust = 1.3))
```
すべてのコードが1行で表示され、追跡が困難になります。
ggplot2(mydata, aes(x, y)) + geom_point() + geom_line() + opts(panel.background = theme_rect(fill = "lightsteelblue2"), panel.border = theme_rect(col = "grey"), panel.grid.major = theme_line(col = "grey90"), axis.ticks = theme_blank(), axis.text.x = theme_text (size = 14, vjust = 0), axis.text.y = theme_text (size = 14, hjust = 1.3))
これを解決するための助けをいただければ幸いです。