to_jupyter: "knit" replacement to generate an ipynb with notedown

Description Usage Arguments Details

View source: R/ipynb.r

Description

This function calls the python program notedown on inputFile and returns the converted Rmd filename to the console and tries to open the converted notebook in a browser after calling jupyter nbconvert.

Usage

1
to_jupyter(inputFile, encoding)

Arguments

inputFile

Rmd input filename

endocoding

unused

Details

Much is assumed (like, you have python installed and setup correctly and also have notedown installed and setup correctly).

You specify this as a knit: replacement in an Rmd YAML header:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
---
title: "ggplot2 example"
knit: markdowntemplates::to_jupyter
output: md_document
---

## Introduction to ggplot2

This is a short demo on how to convert an R Markdown Notebook into an IPython Notebook using knitr and notedown.

Adding a Python Chunk

```{r engine="python"}
def f(x):
  return x + 2
f(2)
```

This is an introduction to [ggplot2](http://github.com/hadley/ggplot2). You can view the source as an R Markdown document, if you are using an IDE like RStudio, or as an IPython notebook, thanks to [notedown](https://github.com/aaren/notedown).

We need to first make sure that we have `ggplot2` and its dependencies installed, using the `install.packages` function.

Now that we have it installed, we can get started by loading it into our workspace

```{r}
library(ggplot2)
```

We are now fully set to try and create some amazing plots.

#### Data

We will use the ubiqutous [iris](http://stat.ethz.ch/R-manual/R-patched/library/datasets/html/iris.html) dataset.

```{r}
head(iris)
```

#### Simple Plot

Let us create a simple scatterplot of `Sepal.Length` with `Petal.Length`.

```{r}
ggplot(iris, aes(x = Sepal.Length, y = Petal.Length)) +
  geom_point()
```

hrbrmstr/markdowntemplates documentation built on June 3, 2018, 12:10 p.m.