Adding line returns in RMarkdown in a loop
By chrisbeeley
Another one that’s for me when I forget. The internet seems strangely reluctant to tell me how to do this, yet here it is buried in the answer to something else.
Sometimes you are writing an RMarkdown document and wish to produce text with line returns between each piece. I can never work out how to do it. It’s very simple. Just two spaces and then \n. Like this ” \n”. Here’s some real code with it in.
<pre class="brush: r; title: ; notranslate" title="">
team_numbers %>%
mutate(print = paste0(TeamN, TeamC, " \n \n")) %>%
pull(print) %>%
cat()
Simple!