Skip to main content

Convert an Sweave document to work in knitr

Project description

Sweave2knitr is a simple Python script that helps to convert Sweave LaTeX documents to be instead compatible with Yihui Xie’s knitr package. It is based on and inspired by Jeromy Anglim’s blog entry, “Converting Sweave LaTeX to knitr LaTeX: A case study.”

Warning: This conversion is not an exact science. While this catches some of the most common issues faced when converting from Sweave to LaTeX, there are a virtually infinite number of special cases that will have to be handled. Furthermore, this is a very early version that has been tested on only a few documents. Try it on your own Sweave documents: contributions are strongly encouraged!

USAGE

If infile.Rnw is your Sweave LaTeX file, use

Sweave2knitr infile.Rnw outfile.nw

You can then use

Rscript -e “library(knitr); knit(‘outfile.nw’, ‘outfile.tex’)” pdflatex outfile.tex

To create the .tex file and turn it into a PDF.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Sweave2knitr-0.1.4.tar.gz (3.6 kB view details)

Uploaded Source

File details

Details for the file Sweave2knitr-0.1.4.tar.gz.

File metadata

File hashes

Hashes for Sweave2knitr-0.1.4.tar.gz
Algorithm Hash digest
SHA256 d9fa0138e136941d084688282c8106ad3d3abc64911c7eec063449b8b2483461
MD5 cef1e215c57cb436f1b6dd9be1693197
BLAKE2b-256 6b7cee7a7512d9b10b0ac89c53aa92933f914110401bf56e4a58204e71085935

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page