-
Notifications
You must be signed in to change notification settings - Fork 385
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from mwouts/v0.5.4
V0.5.4
- Loading branch information
Showing
12 changed files
with
410 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
nbrmd>=0.5.3 | ||
nbrmd>=0.5.4 | ||
plotly | ||
matplotlib | ||
pandas |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
|
||
setup( | ||
name='nbrmd', | ||
version='0.5.3', | ||
version='0.5.4', | ||
author='Marc Wouts', | ||
author_email='[email protected]', | ||
description='Jupyter notebooks as R markdown, Python or R scripts', | ||
|
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,54 @@ | ||
#' The below derives from | ||
#' https://github.com/yihui/knitr/blob/master/inst/examples/knitr-spin.R | ||
#' | ||
#' This is a special R script which can be used to generate a report. You can | ||
#' write normal text in roxygen comments. | ||
#' | ||
#' First we set up some options (you do not have to do this): | ||
|
||
#+ setup, include=FALSE | ||
library(knitr) | ||
opts_chunk$set(fig.path = 'figure/silk-') | ||
|
||
#' The report begins here. | ||
|
||
#+ test-a, cache=FALSE | ||
# boring examples as usual | ||
set.seed(123) | ||
x = rnorm(5) | ||
mean(x) | ||
|
||
#' You can not use here the special syntax {{code}} to embed inline expressions, e.g. | ||
{{mean(x) + 2}} | ||
#' is the mean of x plus 2. | ||
#' The code itself may contain braces, but these are not checked. Thus, | ||
#' perfectly valid (though very strange) R code such as `{{2 + 3}} - {{4 - 5}}` | ||
#' can lead to errors because `2 + 3}} - {{4 - 5` will be treated as inline code. | ||
#' | ||
#' Now we continue writing the report. We can draw plots as well. | ||
|
||
#+ test-b, fig.height=5, fig.width=5 | ||
par(mar = c(4, 4, .1, .1)); plot(x) | ||
|
||
#' Actually you do not have to write chunk options, in which case knitr will use | ||
#' default options. For example, the code below has no options attached: | ||
|
||
var(x) | ||
quantile(x) | ||
|
||
#' And you can also write two chunks successively like this: | ||
|
||
#+ test-chisq5 | ||
sum(x^2) # chi-square distribution with df 5 | ||
#+ test-chisq4 | ||
sum((x - mean(x))^2) # df is 4 now | ||
|
||
#' Done. Call spin('knitr-spin.R') to make silk from sow's ear now and knit a | ||
#' lovely purse. | ||
|
||
# /* you can write comments between /* and */ like C comments (the preceding # | ||
# is optional) | ||
Sys.sleep(60) | ||
# */ | ||
|
||
# /* there is no inline comment; you have to write block comments */ |
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,65 @@ | ||
The below derives from | ||
https://github.com/yihui/knitr/blob/master/inst/examples/knitr-spin.R | ||
|
||
This is a special R script which can be used to generate a report. You can | ||
write normal text in roxygen comments. | ||
|
||
First we set up some options (you do not have to do this): | ||
|
||
```{r setup, include=FALSE} | ||
library(knitr) | ||
opts_chunk$set(fig.path = 'figure/silk-') | ||
``` | ||
|
||
The report begins here. | ||
|
||
```{r test-a, cache=FALSE} | ||
# boring examples as usual | ||
set.seed(123) | ||
x = rnorm(5) | ||
mean(x) | ||
``` | ||
|
||
You can not use here the special syntax {{code}} to embed inline expressions, e.g. | ||
```{r} | ||
{{mean(x) + 2}} | ||
``` | ||
is the mean of x plus 2. | ||
The code itself may contain braces, but these are not checked. Thus, | ||
perfectly valid (though very strange) R code such as `{{2 + 3}} - {{4 - 5}}` | ||
can lead to errors because `2 + 3}} - {{4 - 5` will be treated as inline code. | ||
|
||
Now we continue writing the report. We can draw plots as well. | ||
|
||
```{r test-b, fig.height=5, fig.width=5} | ||
par(mar = c(4, 4, .1, .1)); plot(x) | ||
``` | ||
|
||
Actually you do not have to write chunk options, in which case knitr will use | ||
default options. For example, the code below has no options attached: | ||
|
||
```{r} | ||
var(x) | ||
quantile(x) | ||
``` | ||
|
||
And you can also write two chunks successively like this: | ||
|
||
```{r test-chisq5} | ||
sum(x^2) # chi-square distribution with df 5 | ||
``` | ||
```{r test-chisq4} | ||
sum((x - mean(x))^2) # df is 4 now | ||
``` | ||
|
||
Done. Call spin('knitr-spin.R') to make silk from sow's ear now and knit a | ||
lovely purse. | ||
|
||
```{r} | ||
# /* you can write comments between /* and */ like C comments (the preceding # | ||
# is optional) | ||
Sys.sleep(60) | ||
# */ | ||
# /* there is no inline comment; you have to write block comments */ | ||
``` |
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,172 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"The below derives from\n", | ||
"https://github.com/yihui/knitr/blob/master/inst/examples/knitr-spin.R\n", | ||
"\n", | ||
"This is a special R script which can be used to generate a report. You can\n", | ||
"write normal text in roxygen comments.\n", | ||
"\n", | ||
"First we set up some options (you do not have to do this):" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"hide_output": true, | ||
"name": "setup" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"library(knitr)\n", | ||
"opts_chunk$set(fig.path = 'figure/silk-')" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"The report begins here." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"cache": false, | ||
"name": "test-a" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"# boring examples as usual\n", | ||
"set.seed(123)\n", | ||
"x = rnorm(5)\n", | ||
"mean(x)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": { | ||
"noskipline": true | ||
}, | ||
"source": [ | ||
"You can not use here the special syntax {{code}} to embed inline expressions, e.g." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"noskipline": true | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"{{mean(x) + 2}}" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"is the mean of x plus 2.\n", | ||
"The code itself may contain braces, but these are not checked. Thus,\n", | ||
"perfectly valid (though very strange) R code such as `{{2 + 3}} - {{4 - 5}}`\n", | ||
"can lead to errors because `2 + 3}} - {{4 - 5` will be treated as inline code.\n", | ||
"\n", | ||
"Now we continue writing the report. We can draw plots as well." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"fig.height": 5, | ||
"fig.width": 5, | ||
"name": "test-b" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"par(mar = c(4, 4, .1, .1)); plot(x)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Actually you do not have to write chunk options, in which case knitr will use\n", | ||
"default options. For example, the code below has no options attached:" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"var(x)\n", | ||
"quantile(x)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"And you can also write two chunks successively like this:" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"name": "test-chisq5", | ||
"noskipline": true | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"sum(x^2) # chi-square distribution with df 5" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"name": "test-chisq4" | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"sum((x - mean(x))^2) # df is 4 now" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Done. Call spin('knitr-spin.R') to make silk from sow's ear now and knit a\n", | ||
"lovely purse." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# /* you can write comments between /* and */ like C comments (the preceding #\n", | ||
"# is optional)\n", | ||
"Sys.sleep(60)\n", | ||
"# */\n", | ||
"\n", | ||
"# /* there is no inline comment; you have to write block comments */" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"main_language": "R" | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
Oops, something went wrong.