This notebook converts a Jupyter notebook (.ipynb, JSON) to an Rmarkdown (.Rmd) file.
How it works (high level):
- Reads the notebook JSON into
data. SeeRmarkdown_convert.data. - Detects the notebook language from
data["metadata"]["kernelspec"]["display_name"]. SeeRmarkdown_convert.programming_language. - Extracts
cellsand iterates:- Markdown cells are appended as plain markdown.
- Code cells are wrapped in fenced code blocks using the detected language.
- Prepends a YAML header (
yaml_config) and writes the final string (file_text) toconverted_notebook.Rmd. - Output: a Rmarkdown file
Relevant file:
Reference