0

I am working with knitr, polymode, ess and I would like to export just the R code from my .Rnw into a .R file. A basic file might look something like this:

\documentclass[a4paper]{article}

My Rnw file 

<<>>=
##This is some R code 
1+1 
@

\end{document}

In the end, I would like an R file with just

##This is some R code
1+1
1

In R, tangling is implemented via knitr::purl and utils::Stangle.

ESS provides an interface to these commands. See the variable ess-swv-processor and the ess-swv-weave function (bound to M-n s in Rnw-mode).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.