Adicionando uma quebra de linha aos blocos de códigos no Markdown R
Estou usando o pacote knitr com o R Markdown para criar um relatório HTML. Estou tendo algum problema em manter meu código em linhas separadas ao usar '+'.
Por exemplo,
```{r}
ggplot2(mydata, aes(x, y)) +
geom_point()
```
retornará o seguinte o documento HTML
ggplot2(mydata, aes(x, y)) + geom_point()
Normalmente isso é bom, mas o problema surge quando eu começo a adicionar linhas adicionais, que eu quero manter separadas para tornar o código mais fácil de seguir. Executando o seguinte:
```{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))
```
Isso resultará em todo o código saindo em uma linha, dificultando o acompanhamento:
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))
Qualquer ajuda para resolver isso seria muito apreciada!