如何将RMD文档转换为jupyter笔记本 [英] How can I convert a Rmd document to a jupyter notebook

查看:67
本文介绍了如何将RMD文档转换为jupyter笔记本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要将rmarkdown.Rmd文档转换为jupyter笔记本.ipynb。 我发现从jupyter到rmd的转换很容易使用,如reference page中所述,但是由于某些原因(.)Rstudio团队没有采用其他方式。

例如,我想转换

---
title: "Untitled"
author: "statquant"
date: "03/09/2019"
output: html_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

## R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.

When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

```{r cars}
summary(cars)
```

## Including Plots

You can also embed plots, for example:

```{r pressure, echo=FALSE}
plot(pressure)
```

Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.

推荐答案

检查后,银弹似乎是jupytext 它允许您将markdownrmarkdownpythonipynb等转换为markdownrmarkdownpythonipynb

这实际上可以让您拥有相当整洁的工作流程

  1. 将一个简单R脚本you can spin写入Rmd文档中
  2. 使用knitr::spin('script.R', knit = FALSE)将其转换为Rmd
  3. 使用jupytext --to notebook script.Rmd创建script.ipynb
  4. 共享或执行笔记本

这篇关于如何将RMD文档转换为jupyter笔记本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆