Construct, deconstruct, and convert R markdown files.
Project description
Introduction
The rmdawn Python package allows you to (de)construct, convert, and render R Markdown (Rmd) files in
your terminal (e.g. bash, zsh, fish, etc.) or
your favorite Python environment (e.g. PyCharm or Visual Studio Code).
The rmdawn Python package consists of 6 shell commands and functions:
rmdawn, which concatenates input files to generate an Rmd file.
rmdusk, which extracts 1) a YAML file, 2) Python or R scripts and 3) Markdown (md) files from Rmd files.
rmdtor, which converts Rmd files into R scripts using knitr::purl.
rtormd, which converts R scripts into Rmd files using knitr::spin.
render, which creates rendered versions of R scripts or Rmd files into HTML, PDF, Word, and other output file formats.
catren, which combines the functionality of rmdawn and render to generate an Rmd file from source files and then create an output file.
All rmdawn functions and commands, except for rmdawn and rmdusk, rely on the rpy2 Python library. The command line interface relies on the click Python library.
For a related package that provides programmatic tools for working with Jupyter Notebooks, check out the Nbless Python package.
Documentation and Code
The documentation is hosted at https://marskar.github.io/rmdawn/.
The code is hosted at https://github.com/marskar/rmdawn.
Installation
pip install rmdawn
or clone the repo, e.g. git clone https://github.com/marskar/rmdawn and install locally using setup.py (python setup.py install) or pip (pip install .).
Creating an R markdown file with the rmdawn shell command
rmdawn header.yml intro.md scrape.py plot.R notes.txt > example.Rmd
Extract YAML, markdown, and code files from R markdown files with the rmdusk shell command
rmdusk example.Rmd
Basic usage: Python environment
from pathlib import Path
from rmdawn import rmdawn, rmdusk
# Create an R markdown file from source files
Path("example.Rmd").write_text(
rmdawn(["header.yml", "intro.md", "scrape.py", "plot.R", "notes.txt"])
)
# Extract source files from an R markdown file
rmdusk("example.Rmd")
History
0.0.1 (2018-12-11)
First release on PyPI.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for rmdawn-0.0.19-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9099505019565e7ea45ca2d6c2c97c1f5529ee81ab4ae72173bce57653c2c127 |
|
MD5 | a828c2ff86ee26cafe0ea1651545a497 |
|
BLAKE2b-256 | 63c1c2246837bc5d1a19408c58f8624eb7a61f27e31d49d0c15f909c78dff4e4 |