There was some discussion previously in the community on how to improve delivery of challenges in the Python and R lessons. Quite often, we ‘just’ copy the text of the challenge into the Etherpad and participants then need to switch between the Etherpad and their code editor to work through the challenge. Copying to the Etherpad often also breaks the formatting of the challenge and can be disruptive.
In a post on The Carpentries blog, Sarah Brown described how to make use of the %load
magic command in Jupyter Notebooks with Python and since we used it in the Data Carpentry workshop during CarpentryConnect Johannesburg last year, we were looking for something similar in R. We made use of a pre-written commented script for the challenges, which is a cleaner, shorter version of the code-handout. The questions for the challenges are placed as comments, and spaces are provided where participants can type their code. Participants mentioned that it worked well, because they didn’t have to switch between the Etherpad and RStudio, or look up at the screen to read the questions.
Below is a snippet of the R challenges handout:
## Challenge 8 ##
# 8.1. Instead of creating a data frame with read.csv(), create your own using data.frame()
# The following code has a few mistakes. Fix the code.
animal_data <- data.frame(animal = c(dog, cat, sea cucumber, sea urchin),
feel = c("furry", "squishy", "spiny"),
weight = c(45, 8 1.1, 0.8))
# 8.2. Can you predict the class for each of the columns in the following example?
# Check your guesses using `str(country_climate)`:
country_climate <- data.frame(country=c("Canada", "Panama", "South Africa", "Australia"),
climate=c("cold", "hot", "temperate", "hot/temperate"),
temperature=c(10, 30, 18, "15"),
northern_hemisphere=c(TRUE, TRUE, FALSE, "FALSE"),
has_kangaroo=c(FALSE, FALSE, FALSE, 1))
# 8.2.1. Are they what you expected? Why? why not?
# 8.2.2. What would have been different if we had added `stringsAsFactors = FALSE`
# to this call?
# 8.2.3. What would you need to change to ensure that each column had the
# accurate data type?
# 8.3. How can the code be improved?
## YOUR CODE HERE ##
######################################################
## Challenge 9 ##
# 9.1. Using pipes, subset the survey data to include individuals collected before
# 1995 and retain only columns "year", "sex", and "weight"
## YOUR CODE HERE ##
Feel free to make use of this challenges handout by pasting this link (https://tinyurl.com/y5zzo268) in the workshop Etherpad - once participants click on this link, it will request permission to download the challenges.R script. Since the original code-handout is generated automatically, it would be possible to also automatically generate a handout only containing the challenges nicely formatted. This will give instructors an opportunity to choose what they want to use. It is also possible to use the code/challenges-handout as the basis for your own handout placed in a separate GitHub repository or fork, whose download link can be provided to participants. This way, last minute changes, e.g. extra challenges, can be pushed to the repository without the link changing (cf. Sarah Brown).
At a previous Data Carpentry workshop at Walter Sisulu University the participants mentioned (on sticky note feedback) that a one-page summary of R commands would be really helpful, since learning all these new commands can be overwhelming. Bianca agreed and decided to make this one-page summaRy. We suggest printing enough copies before the workshop and handing them out to the learners, so they can have them next to their computers as a ‘cheat sheet’.
What tips and tricks do you employ in teaching Carpentries workshops? Share with the rest of The Carpentries community by publishing a post about them on this blog!