How to convert R Script to R Markdown?

35 Views Asked by At

Is it possible to convert my R script to an R Markdown? I don't want to get the R Markdown output directly, I know that is possible with knitr::stitch() but I didn't get the script itself converted to markdown by that. My script consists of lot of comments and I would directly transform it into a Markdown file if that is possible.

1

There are 1 best solutions below

0
gdt0 On

You are looking for knitr::spin(hair = "<your-script>.R", knit = FALSE). Read the documentation at ?knitr::spin for information about how to format your comments.