Hi all - how do I run a jupyter notebook that has an R script in it through the command line? And better still, how do I assign parameters that will be read as variables into the script?
Thanks!
Hi all - how do I run a jupyter notebook that has an R script in it through the command line? And better still, how do I assign parameters that will be read as variables into the script?
Thanks!
A general approach using only jupyter first-party means would be:
some-r-notebook.tmpl.ipynb
with your preferred R
mechanismcode
cellsnbconvert
jupyter nbconvert --execute some-r-notebook.ipynb
There are rafts of other solutions, e.g papermill
, ploomber
, but all bring a lot of opinions (e.g. custom metadata) that can make a notebook less portable.