I have a rmarkdown document (.Rmd
) that I've been doing some analysis in. I now realize I would prefer the functionality of LaTeX. Is there an easy way to convert the file to .Rnw
, preserving the chunks (not just the body text)? Articles seem to concentrate on converting the output (i.e. from .html
to .pdf
) or from sweave to markdown.
Asked
Active
Viewed 761 times
5

Hugh
- 15,521
- 12
- 57
- 100
-
My guess would be that you will have to replace all chunks in your `.Rmd` by some placeholders, resulting in a valid markdown `.md`. Then use pandoc to convert it to latex, and, by hand, put all chunks back in and rename it to `.Rnw`. (BTW: are you really sure about sweave? I found going from sweave to knitr/markdown such a relief: not having to debug both my latex _and_ my R code.) – ROLO Sep 22 '15 at 07:24
-
1There's nothing *inside* your chunks that needs to be changed. Only the syntax for chunk start and chunk end is different: *```{r chunkname, options}* vs. *<
>=*. – CL. Sep 22 '15 at 08:08