Convert RMarkdown files to Jupyter Notebook
Convert your work from RStudio to generate blog posts
Many of the people at CorrelAid come from a R background. Even you (the reader) could be more familiar to the R world than to the Python one.
To help you all to easily display your work on the Correlaid blog, here we will introduce a couple of methods to convert R Mardown files into Jupyter Notebook ones.
These are:
Working with Jupytext
Installation
To install Jupytext
, open a terminal (Unix) or a command line window (Windows) and run:
pip install jupytext --upgrade
If you use conda
instead, run:
conda install jupytext -c conda-forge
Convert a R Markdown file
Once the package is installed, using the same Python distro that is used for your Jupyter Notebook/JupyerLab, you can convert a R Markdown file by following these steps:
- Open a terminal (Unix) or a command line window (Windows).
- Navigate to your
script.Rmd
file location. - Run
jupytext --to notebook script.Rmd
to have ascript.ipynb
file. - Make sure that the conversion is correct by opening the newly created notebook via Jupyter Notebook/JupyterLab.
- Share your content on the CorrelAid blog!
Please refer to the project page for further references.
Working with notedown
Installation
To install notedown
, open a terminal (Unix) or a command window (Windows) and run:
pip install notedown
Convert a R Markdown file
Once the package is installed, make sure that you have knitr
instaled as well with your R
instance.
In a terminal (Unix) or command window (Windows) run:
notedown script.Rmd --knit > script.ipynb
Before sharing your content, make sure that the conversion is correct by opening the newly created notebook via Jupyter Notebook/JupyterLab.
Please refer tot he project page for further references.