knitr::opts_chunk$set(echo = TRUE)

Introduction

In this rmd I wrote down

Things I/we learned along the way

chunk headers

Problem: Hints did not always display properly.
Solution: Turned out TRUE should be written as 'TRUE' in chunk headings when working with learnr. If you use for example exercise=T, the hints will not be displayed (annoyingly).

coding exercises

Problem: For fill-in-the-code exercises, we add '___' to the exercise chunk but this gives an error when 'Run Document' is done.
Solution: You should add 'error=TRUE, exercise.eval=FALSE' to the exercise chunk headings.

giving feedback

Checking answers is done with gradethis package. There are (at least, as far as I used) two options for answer checking:

  1. grade_result()

  2. use the chunk title [exercise_chunk_name]-check when you use grade_result().

  3. formulate as, for example:
grade_result(pass_if(~identical(.result, head(distance2NearestFeature(monocytes_h3k4me3, tss_chr19)))))
grade_result(
 pass_if(~identical(.result, heatMatrix(mat = scores_h3k4me3_tss, 
           xcoord = c(-5000, 5000), 
           col = h3k4me3_cols, 
           main = "Unordered H3K4me3 signal, centered at TSS", 
           xlab = "bp (TSS = 0)")
           )),
 correct = 
)
  1. grade_code( [compare the answer with this answer])

  2. use the chunk title [exercise_chunk_name]-code-check when you use grade_code().

  3. provide the code solution in the chunk with title [exercise_chunk_name]-solution
  4. this option works towards the exact code given in the solution chunk with nice feedback. BUT for the answer to be correct the code should really be exactly the same as the solution. Eg: head(a, 2) =/= head(a, n=2).
  5. another BUT; when you want students to generate the plot and you use this method of grading, the plot won't be visualized. Work-a-round1: direct students to hit "Run Code" explicitely before or after "Submit Answer". Work-a-round2: use grade_result() instead.
  6. another BUT not handy if you multiple lines of code and leave blanks. In that case, students might fill out one line and hit "Submit" but will receive weird, not-understandable feedback due to the blanks in the other lines of not-yet-corrected code. Work-a-round1: direct students to fill in all blanks before hitting "Submit Answer". Work-a-round2: use grade_result() instead.
  7. preferentially leave out hints for this type of answer checking.
  8. however, I still added hints to grade_code questions when there were multiple functions where they had to complete the code. This is not really optimal use of learnr. An alternative would have been to chop these questions up in smaller parts but then I would have to prepare setup chunks for each invidual, chopped-up-exercise (as I understood it).

{r naam-solution} exact de code die je verwacht

{r naam-code-check} grade_code()

Possible corrections for next year

Anything else that might be worth to tell the next person working on this.

 DONE (learnr.proto)
Error in validate_signal_args(.subclass) : 
  could not find function "validate_signal_args"
+ solve by restarting R session
label: q3b_h3k4me3plot-hint-3
Quitting from lines 554-556 (fg3.Rmd) 
Error in parse(text = x, srcfile = src) : <text>:2:1: unexpected input
1: # eg
2: _
   ^

--> solve by restarting r and run learnr.dashboard::start_tutorial("fg3") again.



vanheeringen-lab/learnr.proto documentation built on March 1, 2021, 11:10 p.m.