gpt4 book ai didi

jupyter-notebook - 如何将 Rmd 文档转换为 jupyter 笔记本

转载 作者:行者123 更新时间:2023-12-04 08:33:04 30 4
gpt4 key购买 nike

我想转换一个 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
它允许您从/到 mardown 进行转换, rmarkdown , python , ipynb , ...
这实际上可以让你有一个非常整洁的工作流程

  • 写一个简单的 R script.R脚本 you can spinRmd文档
  • 使用 knitr::spin('script.R', knit = FALSE)将其转换为 Rmd
  • 使用 jupytext --to notebook script.Rmd创建 script.ipynb
  • 共享或执行笔记本
  • 关于jupyter-notebook - 如何将 Rmd 文档转换为 jupyter 笔记本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57777009/

    30 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com