Ages ago, I wrote a boatload of slides using knitr + beamer in R. Now I'm revisiting a lot of the material and converting them into RMarkdown slides (I use reveal.js, but that is neither here nor there). While taking an hour or so per lecture to do this is delightful, as it gives me time to catchup on BrainDead while I do the mindless copy-paste-edit, I feel that there has to be a better way. I tried futzing with pandoc to get it to work, and while it would convert the compiled .tex files beautifully to markdown, that means losing all of the code, etc. Essentially, I'd like to convert the original .Rnw files over to new .Rmd files, moving from LaTeX+Beamer to standard RMarkdown.
Thoughts, tips, techniques to do so? Have I missed something blindingly obvious?
Here's a sample .Rnw file gakked from my temp file that I'd futz with to try out different things in the past. temp.Rnw
was the filename.
\documentclass{beamer}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Lecture 6 - Some Lecture
%%%
%%%
%%% Last Modified 9/7/2012
%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{tikz}
\usetikzlibrary{arrows}
%%%%%load in code chunks, and run some preperatory code
<<set-options, echo=FALSE, cache=FALSE>>=
opts_chunk$set(fig.align = "center")
opts_chunk$set(out.height="0.6\\textwidth")
opts_chunk$set(out.width="0.6\\textwidth")
@
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\center \huge Variation in Estimates of Sample Properties
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
<<agraph, echo=FALSE>>=
library(ggplot2)
qplot(mpg, cyl, data=mtcars)
@
\end{frame}
\end{document}
I've tried a number of ways of processing this.
pandoc -s temp.Rnw -o temp.md
is an obvious no-go. I changed temp.Rnw to temp.tex to see if that would work
pandoc -s temp.tex -o temp.text
This produces
Variation in Estimates of Sample Properties
<<agraph, echo=FALSE>>= library(ggplot2) qplot(mpg, cyl,
data=mtcars) @
So, the R code in some places is gone entirely, and others it's very wonky. All formatting is gone.