knitr::opts_chunk$set(echo = TRUE)
In this rmd I wrote down
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).
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.
Checking answers is done with gradethis
package. There are (at least, as far as I used) two options for answer checking:
grade_result()
use the chunk title [exercise_chunk_name]-check
when you use grade_result()
.
grade_result(pass_if(~identical(.result, head(distance2NearestFeature(monocytes_h3k4me3, tss_chr19)))))
correct = [text]
to customize the message displayed when the submitted answer is correct. 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 = )
grade_code( [compare the answer with this answer])
use the chunk title [exercise_chunk_name]-code-check
when you use grade_code()
.
[exercise_chunk_name]-solution
{r naam-solution}
exact de code die je verwacht
{r naam-code-check}
grade_code()
In prepdata.Rmd I wrote out commands I used to prepare some of the objects. Some of the raw data are too bit to include in this tutorial. They can (as for now) be found on cn45/scratch/ctoenhake/edu. --> now relocated to /molbiol/mb03-sdb1/mbdata/ctoenhake/edu/
All BLUEPRINT data were downloaded from the blueprint data portal.
I limited this tutorial to monocyte data of sample C000S5.
Sometimes running learnr.dashboard:::.setup_learnr_proto(lib="/home/ctoenhake/learnr.proto/renv/library/R-3.6/x86_64-pc-linux-gnu", pkg="/home/ctoenhake/learnr.proto")
gives at the end the error:
DONE (learnr.proto) Error in validate_signal_args(.subclass) : could not find function "validate_signal_args"
+ solve by restarting R session
learnr.dashboard::start_tutorial("fg3")
after you've installed the new/corrected tutorial in the package with learnr.dashboard:::.setup_learnr_proto()
, hint chunks with empty functions give an error, eg: 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.
learnr.dashboard:::.setup_learnr_proto(lib="/home/ctoenhake/learnr.proto/renv/library/R-3.6/x86_64-pc-linux-gnu", pkg="/home/ctoenhake/learnr.proto")
and there is a fg#.html in the tutorials dir. Than that html will be loaded upon running learnr.dashboard::start_tutorial("fg3")
instead of your updated tutorial. solve by removing the .html before installing the tutorial.Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.