I am trying to generate an HTML report, using knitr, based on an R script that has for loops. I want to generate markdown comments from the comments within the for loop, but I am not sure if it's possible.
Here is simple example, this is in test.R:
for (i in 1:5) {
## This is a heading for `i`
#' This is a comment for `i`
print(i)
}
Then i use spin to generate a Rmd file:
spin('test.R')
However, the Rmd file looks like the following.
```{r }
for (i in 1:5) {
## This is a heading for `i`
#' This is a comment for `i`
print(i)
}
```
The markdown comments within the R chunk are not compiled into HTML. Is it possible?
Thanks,
Peter
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…