-
Notifications
You must be signed in to change notification settings - Fork 393
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Arguments to %%R now supported in Rmd and py formats #111
- Loading branch information
Showing
11 changed files
with
250 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
39 changes: 39 additions & 0 deletions
39
tests/notebooks/mirror/ipynb_to_Rmd/Notebook_with_R_magic.Rmd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
jupyter: | ||
kernelspec: | ||
display_name: Python 2 | ||
language: python | ||
name: python2 | ||
language_info: | ||
codemirror_mode: | ||
name: ipython | ||
version: 2 | ||
file_extension: .py | ||
mimetype: text/x-python | ||
name: python | ||
nbconvert_exporter: python | ||
pygments_lexer: ipython2 | ||
version: 2.7.11 | ||
--- | ||
|
||
# A notebook with R cells | ||
|
||
This notebook shows the use of R cells to generate plots | ||
|
||
```{python} | ||
# %load_ext rpy2.ipython | ||
``` | ||
|
||
```{r} | ||
suppressMessages(require(tidyverse)) | ||
``` | ||
|
||
```{r} | ||
ggplot(iris, aes(x = Sepal.Length, y = Petal.Length, color=Species)) + geom_point() | ||
``` | ||
|
||
The default plot dimensions are not good for us, so we use the -w and -h parameters in %%R magic to set the plot size | ||
|
||
```{r magic_args='-w 400 -h 240'} | ||
ggplot(iris, aes(x = Sepal.Length, y = Petal.Length, color=Species)) + geom_point() | ||
``` |
40 changes: 40 additions & 0 deletions
40
tests/notebooks/mirror/ipynb_to_percent/Notebook_with_R_magic.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# --- | ||
# jupyter: | ||
# kernelspec: | ||
# display_name: Python 2 | ||
# language: python | ||
# name: python2 | ||
# language_info: | ||
# codemirror_mode: | ||
# name: ipython | ||
# version: 2 | ||
# file_extension: .py | ||
# mimetype: text/x-python | ||
# name: python | ||
# nbconvert_exporter: python | ||
# pygments_lexer: ipython2 | ||
# version: 2.7.11 | ||
# --- | ||
|
||
# %% [markdown] | ||
# # A notebook with R cells | ||
# | ||
# This notebook shows the use of R cells to generate plots | ||
|
||
# %% | ||
%load_ext rpy2.ipython | ||
|
||
# %% | ||
%%R | ||
suppressMessages(require(tidyverse)) | ||
|
||
# %% | ||
%%R | ||
ggplot(iris, aes(x = Sepal.Length, y = Petal.Length, color=Species)) + geom_point() | ||
|
||
# %% [markdown] | ||
# The default plot dimensions are not good for us, so we use the -w and -h parameters in %%R magic to set the plot size | ||
|
||
# %% | ||
%%R -w 400 -h 240 | ||
ggplot(iris, aes(x = Sepal.Length, y = Petal.Length, color=Species)) + geom_point() |
35 changes: 35 additions & 0 deletions
35
tests/notebooks/mirror/ipynb_to_script/Notebook_with_R_magic.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# --- | ||
# jupyter: | ||
# kernelspec: | ||
# display_name: Python 2 | ||
# language: python | ||
# name: python2 | ||
# language_info: | ||
# codemirror_mode: | ||
# name: ipython | ||
# version: 2 | ||
# file_extension: .py | ||
# mimetype: text/x-python | ||
# name: python | ||
# nbconvert_exporter: python | ||
# pygments_lexer: ipython2 | ||
# version: 2.7.11 | ||
# --- | ||
|
||
# # A notebook with R cells | ||
# | ||
# This notebook shows the use of R cells to generate plots | ||
|
||
# %load_ext rpy2.ipython | ||
|
||
# + {"language": "R"} | ||
# suppressMessages(require(tidyverse)) | ||
|
||
# + {"language": "R"} | ||
# ggplot(iris, aes(x = Sepal.Length, y = Petal.Length, color=Species)) + geom_point() | ||
# - | ||
|
||
# The default plot dimensions are not good for us, so we use the -w and -h parameters in %%R magic to set the plot size | ||
|
||
# + {"magic_args": "-w 400 -h 240", "language": "R"} | ||
# ggplot(iris, aes(x = Sepal.Length, y = Petal.Length, color=Species)) + geom_point() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters