不打开markdown文件运行其中的代码

Rmarkdown 

Rmd to R scripts

Rmd 文件转化为 R 脚本,不运行 R 代码。

knitr::purl("test.Rmd","test.R", documentation = 2)

# doucumenation:0、不输出注释

#                             1、输出函数外注释

#                             2、输出所有注释

运行 R 代码并输出 html 等等

rmarkdown::render(input="path_to_your_file.rmd",

                                quiet = TRUE,    # 不输出编译的过程

                                output_format =  “html_document”  #“pdf_document”  “word_document”

                                 output_file='output.html'    # 默认输出 html

                                output_dir = './path/to/')

通过 bash 运行 Rmd

Rscript -e "rmarkdown::render('report.Rmd', output_dir='path/to/output_directory')"

# 会生成 report.html 文件

Jupyter Notebook

ipynb to scripts

提取 ipynb 中的代码为脚本

jupyter nbconvert --to script your_notebook.ipynb

运行脚本并输出 html

jupyter nbconvert --execute --to html your_notebook.ipynb

jupyter nbconvert --to notebook --execute your_notebook.ipynb --output executed_notebook.ipynb
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

QH_ShareHub

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值