Skip to content

Instantly share code, notes, and snippets.

@amackcrane
amackcrane / knitr-spin-py
Last active March 9, 2020 18:40
knitr::spin functionality for python
#!/bin/bash
## Rmarkdown has an engine for native python code, but
## knitr::spin (which facilitates dual report/script
## functionality without code duplication by translating
## from .R to .Rmd) doesn't.
## Luckily, we don't need to parse anything, just convert
## markdown annotations to plain text, and code chunks to
## rmarkdown format.
## Note that, unlike with knitr::spin, code not in chunks