Skip to content

Commit 6982781

Browse files
Add in magic R command and fix typo
1 parent 066341f commit 6982781

File tree

8 files changed

+175
-23
lines changed

8 files changed

+175
-23
lines changed

individual_modules/improve_your_r_code/data_table.ipynb

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,31 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"metadata": {
7+
"editable": true,
8+
"slideshow": {
9+
"slide_type": ""
10+
},
11+
"tags": [
12+
"remove-input"
13+
]
14+
},
15+
"outputs": [],
16+
"source": [
17+
"%load_ext rpy2.ipython"
18+
]
19+
},
320
{
421
"cell_type": "markdown",
5-
"metadata": {},
22+
"metadata": {
23+
"editable": true,
24+
"slideshow": {
25+
"slide_type": ""
26+
},
27+
"tags": []
28+
},
629
"source": [
730
"# Fast Data Manipulation Using the `data.table` Package\n",
831
"## Overview\n",
@@ -736,7 +759,7 @@
736759
],
737760
"metadata": {
738761
"kernelspec": {
739-
"display_name": "Python 3",
762+
"display_name": "Python 3 (ipykernel)",
740763
"language": "python",
741764
"name": "python3"
742765
},
@@ -750,7 +773,7 @@
750773
"name": "python",
751774
"nbconvert_exporter": "python",
752775
"pygments_lexer": "ipython3",
753-
"version": "3.9.6"
776+
"version": "3.9.19"
754777
}
755778
},
756779
"nbformat": 4,

individual_modules/improve_your_r_code/microbenchmark.ipynb

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,31 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"metadata": {
7+
"editable": true,
8+
"slideshow": {
9+
"slide_type": ""
10+
},
11+
"tags": [
12+
"remove-input"
13+
]
14+
},
15+
"outputs": [],
16+
"source": [
17+
"%load_ext rpy2.ipython"
18+
]
19+
},
320
{
421
"cell_type": "markdown",
5-
"metadata": {},
22+
"metadata": {
23+
"editable": true,
24+
"slideshow": {
25+
"slide_type": ""
26+
},
27+
"tags": []
28+
},
629
"source": [
730
"## Measuring Speed with Microbenchmark\n",
831
"One way of measuring the time taken to run an R function is to invoke the `Sys.time()` function from the `base` R package. Consider the following toy function:"
@@ -179,7 +202,7 @@
179202
],
180203
"metadata": {
181204
"kernelspec": {
182-
"display_name": "Python 3",
205+
"display_name": "Python 3 (ipykernel)",
183206
"language": "python",
184207
"name": "python3"
185208
},
@@ -193,9 +216,9 @@
193216
"name": "python",
194217
"nbconvert_exporter": "python",
195218
"pygments_lexer": "ipython3",
196-
"version": "3.9.6"
219+
"version": "3.9.19"
197220
}
198221
},
199222
"nbformat": 4,
200-
"nbformat_minor": 2
223+
"nbformat_minor": 4
201224
}

individual_modules/improve_your_r_code/parallelisation.ipynb

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,31 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"metadata": {
7+
"editable": true,
8+
"slideshow": {
9+
"slide_type": ""
10+
},
11+
"tags": [
12+
"remove-input"
13+
]
14+
},
15+
"outputs": [],
16+
"source": [
17+
"%load_ext rpy2.ipython"
18+
]
19+
},
320
{
421
"cell_type": "markdown",
5-
"metadata": {},
22+
"metadata": {
23+
"editable": true,
24+
"slideshow": {
25+
"slide_type": ""
26+
},
27+
"tags": []
28+
},
629
"source": [
730
"# Parallelisation Using the `parallel` Package\n",
831
"The following section is based off of [these notes](https://dept.stat.lsa.umich.edu/~jerrick/courses/stat506_f24/16-parallel-processing.html) written by Josh Errickson at the University of Michigan. Additional information can be found in the [documentation](https://stat.ethz.ch/R-manual/R-devel/library/parallel/doc/parallel.pdf) for the parallel package.\n",
@@ -218,7 +241,7 @@
218241
],
219242
"metadata": {
220243
"kernelspec": {
221-
"display_name": "Python 3",
244+
"display_name": "Python 3 (ipykernel)",
222245
"language": "python",
223246
"name": "python3"
224247
},
@@ -232,7 +255,7 @@
232255
"name": "python",
233256
"nbconvert_exporter": "python",
234257
"pygments_lexer": "ipython3",
235-
"version": "3.9.6"
258+
"version": "3.9.19"
236259
}
237260
},
238261
"nbformat": 4,

individual_modules/improve_your_r_code/rcpp.ipynb

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,31 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"metadata": {
7+
"editable": true,
8+
"slideshow": {
9+
"slide_type": ""
10+
},
11+
"tags": [
12+
"remove-input"
13+
]
14+
},
15+
"outputs": [],
16+
"source": [
17+
"%load_ext rpy2.ipython"
18+
]
19+
},
320
{
421
"cell_type": "markdown",
5-
"metadata": {},
22+
"metadata": {
23+
"editable": true,
24+
"slideshow": {
25+
"slide_type": ""
26+
},
27+
"tags": []
28+
},
629
"source": [
730
"# Acceleration via `Rcpp` (advanced)\n",
831
"## Overview\n",
@@ -321,7 +344,7 @@
321344
],
322345
"metadata": {
323346
"kernelspec": {
324-
"display_name": "Python 3",
347+
"display_name": "Python 3 (ipykernel)",
325348
"language": "python",
326349
"name": "python3"
327350
},
@@ -335,7 +358,7 @@
335358
"name": "python",
336359
"nbconvert_exporter": "python",
337360
"pygments_lexer": "ipython3",
338-
"version": "3.9.6"
361+
"version": "3.9.19"
339362
}
340363
},
341364
"nbformat": 4,

individual_modules/improve_your_r_code/style.ipynb

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,31 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"metadata": {
7+
"editable": true,
8+
"slideshow": {
9+
"slide_type": ""
10+
},
11+
"tags": [
12+
"remove-input"
13+
]
14+
},
15+
"outputs": [],
16+
"source": [
17+
"%load_ext rpy2.ipython"
18+
]
19+
},
320
{
421
"cell_type": "markdown",
5-
"metadata": {},
22+
"metadata": {
23+
"editable": true,
24+
"slideshow": {
25+
"slide_type": ""
26+
},
27+
"tags": []
28+
},
629
"source": [
730
"# Style Guides and Linters\n",
831
"\n",
@@ -28,7 +51,7 @@
2851
"\n",
2952
"If you have to import a set of libraries, do so at the beginning of the file using `library()` as opposed to loading them sporadically throughout the file.\n",
3053
"\n",
31-
"Often, using comments such as `# ---------- ... ------------` can be useful to increase readability and indicate the purpose of each sub-section in the script. For example, one way of organising a small script could be as follows:\n"
54+
"Often, using comments such as `# ---------- ... ------------` can be useful to increase readability and indicate the purpose of each sub-section in the script. For example, one way of organising a small script could be as follows:"
3255
]
3356
},
3457
{
@@ -513,7 +536,7 @@
513536
],
514537
"metadata": {
515538
"kernelspec": {
516-
"display_name": "Python 3",
539+
"display_name": "Python 3 (ipykernel)",
517540
"language": "python",
518541
"name": "python3"
519542
},
@@ -527,7 +550,7 @@
527550
"name": "python",
528551
"nbconvert_exporter": "python",
529552
"pygments_lexer": "ipython3",
530-
"version": "3.9.6"
553+
"version": "3.9.19"
531554
}
532555
},
533556
"nbformat": 4,

individual_modules/improve_your_r_code/vectorisation.ipynb

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,31 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"metadata": {
7+
"editable": true,
8+
"slideshow": {
9+
"slide_type": ""
10+
},
11+
"tags": [
12+
"remove-input"
13+
]
14+
},
15+
"outputs": [],
16+
"source": [
17+
"%load_ext rpy2.ipython"
18+
]
19+
},
320
{
421
"cell_type": "markdown",
5-
"metadata": {},
22+
"metadata": {
23+
"editable": true,
24+
"slideshow": {
25+
"slide_type": ""
26+
},
27+
"tags": []
28+
},
629
"source": [
730
"# Vectorization in R\n",
831
"For further information, refer to Section 24.5 of [Improving Performance](https://adv-r.hadley.nz/perf-improve.html) by Hadley Wickham.\n",
@@ -152,7 +175,7 @@
152175
],
153176
"metadata": {
154177
"kernelspec": {
155-
"display_name": "Python 3",
178+
"display_name": "Python 3 (ipykernel)",
156179
"language": "python",
157180
"name": "python3"
158181
},
@@ -166,7 +189,7 @@
166189
"name": "python",
167190
"nbconvert_exporter": "python",
168191
"pygments_lexer": "ipython3",
169-
"version": "3.9.6"
192+
"version": "3.9.19"
170193
}
171194
},
172195
"nbformat": 4,

individual_modules/section_landing_pages/improve_your_r_code.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ By the end of this course, you will:
1414
- Make use of packages such as `data.table`, `parallel`, `parallelly`, and `Rcpp` to write faster R programs.
1515
- Understand and apply reproducible and stylistic practices using tools like `styler`.
1616

17-
## Pre-requisite Knowlede
17+
## Pre-requisite Knowledge
1818

1919
This workshop is designed for learners who:
2020

programme_information/improve_your_r_code.ipynb

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@
33
{
44
"cell_type": "markdown",
55
"id": "d12d0776-b63e-4cdf-8af7-2738a6b2ce37",
6-
"metadata": {},
6+
"metadata": {
7+
"editable": true,
8+
"slideshow": {
9+
"slide_type": ""
10+
},
11+
"tags": []
12+
},
713
"source": [
814
"# Improve Your R Code\n",
915
"\n",
@@ -73,7 +79,15 @@
7379
"cell_type": "code",
7480
"execution_count": 1,
7581
"id": "30d0103f-b3fb-4e2b-91c2-fc5742eede56",
76-
"metadata": {},
82+
"metadata": {
83+
"editable": true,
84+
"slideshow": {
85+
"slide_type": ""
86+
},
87+
"tags": [
88+
"remove-input"
89+
]
90+
},
7791
"outputs": [
7892
{
7993
"data": {

0 commit comments

Comments
 (0)