-
Notifications
You must be signed in to change notification settings - Fork 1
/
08-Teaching.Rmd
150 lines (86 loc) · 7.23 KB
/
08-Teaching.Rmd
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# Teaching with R {#chap-enseigner}
\toc{1}
R, RStudio and GitHub provide tools for teaching.
The **learnr** package allows you to make interactive tutorials.
We will also see how to use *GitHub Classrooms* which allow to distribute to a class (a list of students with a GitHub account) a repository model (a draft of an R project) that each student will have to develop and publish.
The classroom tools allow to evaluate the work done quite easily.
## learnr
**learnr** allows you to make code snippets of any document produced by R Markdown in HTML interactive, by transforming them into Shiny applications.
The documentation on the RStudio website[^801] is very clear and will not be repeated here: we will only see how to start and how to distribute the tutorials.
[^801]: https://rstudio.github.io/learnr/
### First tutorial
With the menu "File > New File > RMarkdown..." create a new document from an "Interactive Tutorial" template.
The wizard creates a folder with the chosen name, to be transformed into an R project and put under source control, as for all documents seen previously (see section \@ref(sec:memo)).
To run the tutorial, click on the "Run Document" button, which is in the usual place of the "Knit" button.
Tutorials can include exercises, which are code snippets with the `exercise=TRUE` option.
These exercises are displayed as a window of code that can be edited and executed by the user.
Hints can be given[^802], a button added to display the solution, a time limit can be set[^803], and both the code and its result can be compared to an expected value[^804].
[^802]: https://rstudio.github.io/learnr/exercises.html#Hints_and_Solutions
[^803]: https://rstudio.github.io/learnr/exercises.html#Time_Limits
[^804]: https://rstudio.github.io/learnr/exercises.html#Exercise_Checking
Quizzes[^805] can be added, in the form of multiple or single choice quizzes.
[^805]: https://rstudio.github.io/learnr/questions.html
The user's progress in the tutorial (code entered, answers to questions...) is saved by **learnr** on the workstation.
A tutorial can be stopped and resumed without loss of data.
On the other hand, there is no easy way to recover this data for an evaluation by the trainer for example.
### Sharing
Tutorials can be distributed by copying the files or by telling users to clone the GitHub projects that contain them.
They can also be hosted on Shinyapps.io (see section \@ref(sec:hebergement-shiny)).
Last, they can be included in a package[^806].
[^806]: https://rstudio.github.io/learnr/publishing.html#R_Package
## GitHub Classrooms
GitHub Classrooms allows to distribute to a student audience GitHub repositories to modify and control the result.
The applications are as well the learning of R as the production of documents, for a personal work or an exam for example.
### Registration
To start using the tool, you need to open an account.
On the GitHub Classrooms website[^807], click on "Sign in" and use your GitHub account to authenticate.
[^807]: https://classroom.github.com/
### Organizations
The next step is to create a GitHub organization.
A GitHub organization basically contains members (GitHub account holders) and repositories that can be accessed at https://github.com/<Organization>/<RepoID>.
The simplest way to work is to create an organization per course, but other approaches are possible in structures that use the tool extensively.
The organization created for the example here is "Cours-R"[^808].
[^808]: https://github.com/Cours-R
An email address is required (use the same as that of your GitHub account) and the organization must be declared as belonging to your personal account.
If the organization is not visible on the GitHub Classrooms page, click on "Grant us access".
### New Classroom
A classroom is populated with students who will receive tasks to perform.
Click on *New Classroom*.
Select the organization in charge of administering the classroom.
Enter the name of the classroom: a good practice is to prefix it with the name of the course and add the name of the session, for example "Cours-R-2020".
Do not add collaborators (this will be possible later), and eventually enter the list of students (one name per line, also possible later).
The class is created.
All classrooms are visible from the GitHub Classrooms homepage[^809].
Click on a name to open one.
The "Settings" button allows to change its name or to delete it.
The "TAs and Admins" button allows you to add collaborators, i.e. other GitHub users who will be able to administer the classroom.
[^809]: https://classroom.github.com/classrooms
The "Students" button allows to add students.
The list of names is free, with no mandatory format.
Click on "Create Roster" to activate it.
The names must then be linked to GitHub accounts: this work can be done by the administrator or by the students themselves when they receive the first task to be done.
Each student must have an account on GitHub.
### Prepare a repository template
A task is a GitHub repository to modify.
For example[^810], create a repository containing an R project with a Markdown file describing the work to be done and possibly some of the code needed to do it, the other files in the R Markdown template used and a data file.
[^810]: https://github.com/EricMarcon/Cours-R-Memo/settings
Open the repository properties on GitHub and check the *Template Repository* box to make it a template.
#### Assign a task
Open a classroom and click on "New Assignment".
Enter an explicit title for the students, an optional deadline and choose "Individual Assignment".
By default, the assignment name is used as a prefix for the students' submission names, but it can be replaced by a prefix of your choice.
When students turn in their work, all repositories for all tasks will be stored in the organization.
The repository created on each student's account can be private or public, depending on whether you want students to be able to see each other's work or not.
Give the administration right and make the site public if the students should be able to activate GitHub pages to present the results of their work.
Click on "Continue".
Select the model repository (*starter code*) then click on "Continue" then "Create Assignment".
The new task is created.
It is associated with an invitation link that must be copied and sent to the students.
When they click on the link, they will reach a GitHub page that will allow them to associate their account with a name in the list (no control is possible: the first one connected can associate with any name).
They will then be able to create a new RStudio project from the GitHub repository automatically created by GitHub Classrooms, modify that project according to the work instructions and push it to GitHub.
The repository is on the account of the organization the class is connected to, and is suffixed with the student's GitHub ID.
#### Controlling student work
It is possible to view each repository created by students from the assignment page on GitHub Classrooms.
If the assignment to be produced is a written document, have students place it in the repository's GitHub pages to read it directly online.
The GitHub Classrooms wizard[^811] allows you to download all student repositories at once to correct them on your workstation.
[^811]: https://classroom.github.com/assistant