I use the code below to insert text in rmarkdown.
```{r, results='asis', echo=FALSE, warning=FALSE, message=FALSE}
cat("#", "We", "\n")
```
It worked well and gave me the output
# We
However, when I inserted some R code in this chunk like:
```{r, results='asis', echo=FALSE, warning=FALSE, message=FALSE}
x <- 1:100
mean(x)
cat("#", "We", "\n")
}
```
then it gave me the output:
# [1] 50.5 # We
In this case, We was no longer a header.
catdoesn't work.cat('\n')by itself betweenmean(x)andcat('#', ... ). I'm not wholly sure why it works, but it works.