I Have below code which works fine in R markdown.
```{r setup, include=FALSE}
library(knitr)
opts_chunk$set(echo = FALSE)
```
```{r, echo=FALSE, include= FALSE}
Names<-c("Apple","banana","Orange")
```
# Apple
```{r, echo=FALSE}
print(Names[1])
```
# banana
```{r, echo=FALSE}
print(Names[2])
```
# Orange
```{r, echo=FALSE}
print(Names[3])
```
But I dont want to write 3 chunks just to enter heading in R markdown.
I can write code in one chink as below. But how do i add heading within code chunk in for loop. So every new loop we enter new heading in ouput generated.
```{r, echo=FALSE, include= FALSE}
x=3
for( i in 1:x)
{
####here i want to insert heading after vry loop in Markdown with value of Names[i]###
print(Names[i])
}
```
Thanks for your help