Skip to content

Commit f05818b

Browse files
Merge pull request #245 from coding-for-reproducible-research/improve-your-r-code-material
Improve Your R Code Update License and Rerun Notebooks
2 parents c2643d4 + de8df50 commit f05818b

File tree

8 files changed

+324
-202
lines changed

8 files changed

+324
-202
lines changed

individual_modules/improve_your_r_code/LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
The instructional material in this course is copyright © 2024 University of Exeter
55
and is made available under the Creative Commons Attribution 4.0 International
66
licence (https://creativecommons.org/licenses/by/4.0/). Instructional material
7-
consists of material that is contained within the "individual_modules/introduction_to_julia" directory, and images folders in
7+
consists of material that is contained within the "individual_modules/improve_your_r_code" directory, and images folders in
88
this directory, with the exception of code snippets and example programs found
99
in files within these folders. Such code snippets and example programs are
1010
considered software for the purposes of this licence.

individual_modules/improve_your_r_code/data_table.ipynb

Lines changed: 49 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 10,
5+
"execution_count": 1,
66
"metadata": {},
77
"outputs": [
88
{
9-
"name": "stdout",
9+
"name": "stderr",
1010
"output_type": "stream",
1111
"text": [
12-
"The rpy2.ipython extension is already loaded. To reload it, use:\n",
13-
" %reload_ext rpy2.ipython\n"
12+
"/Users/cc1333/Library/Python/3.9/lib/python/site-packages/rpy2/ipython/rmagic.py:77: UserWarning: The Python package `pandas` is strongly recommended when using `rpy2.ipython`. Unfortunately it could not be loaded (error: No module named 'pandas'), but at least we found `numpy`.\n",
13+
" warnings.warn('The Python package `pandas` is strongly '\n"
1414
]
1515
}
1616
],
@@ -20,7 +20,7 @@
2020
},
2121
{
2222
"cell_type": "code",
23-
"execution_count": 11,
23+
"execution_count": 2,
2424
"metadata": {},
2525
"outputs": [],
2626
"source": [
@@ -29,13 +29,6 @@
2929
" suppressMessages({\n",
3030
" library(data.table)\n",
3131
" library(dplyr)\n",
32-
" library(learnr)\n",
33-
" library(microbenchmark)\n",
34-
" library(parallel)\n",
35-
" library(parallelly)\n",
36-
" library(profvis)\n",
37-
" library(Rcpp)\n",
38-
" library(styler)\n",
3932
" })\n",
4033
"})"
4134
]
@@ -68,7 +61,7 @@
6861
},
6962
{
7063
"cell_type": "code",
71-
"execution_count": 12,
64+
"execution_count": 3,
7265
"metadata": {},
7366
"outputs": [
7467
{
@@ -144,7 +137,7 @@
144137
},
145138
{
146139
"cell_type": "code",
147-
"execution_count": 13,
140+
"execution_count": 4,
148141
"metadata": {},
149142
"outputs": [],
150143
"source": [
@@ -176,7 +169,7 @@
176169
},
177170
{
178171
"cell_type": "code",
179-
"execution_count": 15,
172+
"execution_count": 5,
180173
"metadata": {},
181174
"outputs": [
182175
{
@@ -219,7 +212,7 @@
219212
},
220213
{
221214
"cell_type": "code",
222-
"execution_count": 16,
215+
"execution_count": 6,
223216
"metadata": {},
224217
"outputs": [
225218
{
@@ -257,7 +250,7 @@
257250
},
258251
{
259252
"cell_type": "code",
260-
"execution_count": 17,
253+
"execution_count": 7,
261254
"metadata": {},
262255
"outputs": [
263256
{
@@ -308,7 +301,7 @@
308301
},
309302
{
310303
"cell_type": "code",
311-
"execution_count": 18,
304+
"execution_count": 8,
312305
"metadata": {},
313306
"outputs": [
314307
{
@@ -348,7 +341,7 @@
348341
},
349342
{
350343
"cell_type": "code",
351-
"execution_count": 19,
344+
"execution_count": 9,
352345
"metadata": {},
353346
"outputs": [
354347
{
@@ -376,7 +369,7 @@
376369
},
377370
{
378371
"cell_type": "code",
379-
"execution_count": 20,
372+
"execution_count": 10,
380373
"metadata": {},
381374
"outputs": [
382375
{
@@ -411,7 +404,7 @@
411404
},
412405
{
413406
"cell_type": "code",
414-
"execution_count": 22,
407+
"execution_count": 11,
415408
"metadata": {},
416409
"outputs": [
417410
{
@@ -439,7 +432,7 @@
439432
},
440433
{
441434
"cell_type": "code",
442-
"execution_count": 23,
435+
"execution_count": 12,
443436
"metadata": {},
444437
"outputs": [
445438
{
@@ -469,14 +462,14 @@
469462
},
470463
{
471464
"cell_type": "code",
472-
"execution_count": null,
465+
"execution_count": 13,
473466
"metadata": {},
474467
"outputs": [
475468
{
476469
"name": "stdout",
477470
"output_type": "stream",
478471
"text": [
479-
"[1] \"<0x119cc0000>\"\n"
472+
"[1] \"<0x11d9e5800>\"\n"
480473
]
481474
}
482475
],
@@ -488,14 +481,14 @@
488481
},
489482
{
490483
"cell_type": "code",
491-
"execution_count": 28,
484+
"execution_count": 14,
492485
"metadata": {},
493486
"outputs": [
494487
{
495488
"name": "stdout",
496489
"output_type": "stream",
497490
"text": [
498-
"[1] \"<0x119cc0000>\"\n"
491+
"[1] \"<0x11d9e5800>\"\n"
499492
]
500493
}
501494
],
@@ -507,14 +500,14 @@
507500
},
508501
{
509502
"cell_type": "code",
510-
"execution_count": 29,
503+
"execution_count": 15,
511504
"metadata": {},
512505
"outputs": [
513506
{
514507
"name": "stdout",
515508
"output_type": "stream",
516509
"text": [
517-
"[1] \"<0x11845e698>\"\n"
510+
"[1] \"<0x11d49cd40>\"\n"
518511
]
519512
}
520513
],
@@ -526,19 +519,19 @@
526519
},
527520
{
528521
"cell_type": "code",
529-
"execution_count": 30,
522+
"execution_count": 16,
530523
"metadata": {},
531524
"outputs": [
532525
{
533526
"name": "stdout",
534527
"output_type": "stream",
535528
"text": [
536-
"tracemem[0x11845e698 -> 0x1184b9680]: initialize <Anonymous> mutate_cols mutate.data.frame mutate %>% <Anonymous> <Anonymous> <Anonymous> \n",
537-
"tracemem[0x1184b9680 -> 0x1184b9300]: dplyr_new_list initialize <Anonymous> mutate_cols mutate.data.frame mutate %>% <Anonymous> <Anonymous> <Anonymous> \n",
538-
"tracemem[0x1184b9300 -> 0x1184b92c8]: dplyr_new_list initialize <Anonymous> mutate_cols mutate.data.frame mutate %>% <Anonymous> <Anonymous> <Anonymous> \n",
539-
"tracemem[0x11845e698 -> 0x1184e40e0]: new_data_frame vec_data as.list dplyr_col_modify.data.frame dplyr_col_modify mutate.data.frame mutate %>% <Anonymous> <Anonymous> <Anonymous> \n",
540-
"tracemem[0x1184e40e0 -> 0x1184e4038]: as.list.data.frame as.list dplyr_col_modify.data.frame dplyr_col_modify mutate.data.frame mutate %>% <Anonymous> <Anonymous> <Anonymous> \n",
541-
"[1] \"<0x1186c3e48>\"\n"
529+
"tracemem[0x11d49cd40 -> 0x11d3caf38]: initialize <Anonymous> mutate_cols mutate.data.frame mutate %>% <Anonymous> <Anonymous> <Anonymous> \n",
530+
"tracemem[0x11d3caf38 -> 0x11d3cb280]: dplyr_new_list initialize <Anonymous> mutate_cols mutate.data.frame mutate %>% <Anonymous> <Anonymous> <Anonymous> \n",
531+
"tracemem[0x11d3cb280 -> 0x11d3cb2b8]: dplyr_new_list initialize <Anonymous> mutate_cols mutate.data.frame mutate %>% <Anonymous> <Anonymous> <Anonymous> \n",
532+
"tracemem[0x11d49cd40 -> 0x11d39e090]: new_data_frame vec_data as.list dplyr_col_modify.data.frame dplyr_col_modify mutate.data.frame mutate %>% <Anonymous> <Anonymous> <Anonymous> \n",
533+
"tracemem[0x11d39e090 -> 0x11d39e1a8]: as.list.data.frame as.list dplyr_col_modify.data.frame dplyr_col_modify mutate.data.frame mutate %>% <Anonymous> <Anonymous> <Anonymous> \n",
534+
"[1] \"<0x14631ea08>\"\n"
542535
]
543536
}
544537
],
@@ -560,26 +553,26 @@
560553
},
561554
{
562555
"cell_type": "code",
563-
"execution_count": 31,
556+
"execution_count": 17,
564557
"metadata": {},
565558
"outputs": [
566559
{
567560
"name": "stdout",
568561
"output_type": "stream",
569562
"text": [
570-
" x\n",
571-
" <num>\n",
572-
" 1: 0.08722859\n",
573-
" 2: 0.31678578\n",
574-
" 3: 0.71779344\n",
575-
" 4: -0.79386835\n",
576-
" 5: 1.30777816\n",
577-
" --- \n",
578-
"196: -0.20652236\n",
579-
"197: -0.14925841\n",
580-
"198: -0.31833419\n",
581-
"199: -0.12908298\n",
582-
"200: -1.27507388\n"
563+
" x\n",
564+
" <num>\n",
565+
" 1: 0.6642543\n",
566+
" 2: 0.2826647\n",
567+
" 3: -0.8785894\n",
568+
" 4: -0.5096216\n",
569+
" 5: 0.1665126\n",
570+
" --- \n",
571+
"196: -1.9311627\n",
572+
"197: 1.2559794\n",
573+
"198: -0.3076927\n",
574+
"199: 0.2261218\n",
575+
"200: 0.5263950\n"
583576
]
584577
}
585578
],
@@ -602,7 +595,7 @@
602595
},
603596
{
604597
"cell_type": "code",
605-
"execution_count": 32,
598+
"execution_count": 18,
606599
"metadata": {},
607600
"outputs": [
608601
{
@@ -638,7 +631,7 @@
638631
},
639632
{
640633
"cell_type": "code",
641-
"execution_count": 33,
634+
"execution_count": 19,
642635
"metadata": {},
643636
"outputs": [
644637
{
@@ -676,7 +669,7 @@
676669
},
677670
{
678671
"cell_type": "code",
679-
"execution_count": 34,
672+
"execution_count": 20,
680673
"metadata": {},
681674
"outputs": [
682675
{
@@ -719,7 +712,7 @@
719712
},
720713
{
721714
"cell_type": "code",
722-
"execution_count": 37,
715+
"execution_count": 21,
723716
"metadata": {},
724717
"outputs": [
725718
{
@@ -758,7 +751,7 @@
758751
},
759752
{
760753
"cell_type": "code",
761-
"execution_count": 38,
754+
"execution_count": 22,
762755
"metadata": {},
763756
"outputs": [
764757
{
@@ -784,7 +777,7 @@
784777
],
785778
"metadata": {
786779
"kernelspec": {
787-
"display_name": "Python 3 (ipykernel)",
780+
"display_name": "Python 3",
788781
"language": "python",
789782
"name": "python3"
790783
},
@@ -798,7 +791,7 @@
798791
"name": "python",
799792
"nbconvert_exporter": "python",
800793
"pygments_lexer": "ipython3",
801-
"version": "3.9.19"
794+
"version": "3.9.6"
802795
}
803796
},
804797
"nbformat": 4,

0 commit comments

Comments
 (0)