When authoring an R package with learnr
tutorials, is there a way to make them appear in an order that is not alphabetical, but user defined?
See the following example: The hello
tutorial is most basic and should appear first. But the tutorials are alphabetically sorted by their name.
learnr::available_tutorials("learnr")
Available tutorials:
* learnr
- ex-data-basics : "Data basics"
- ex-data-filter : "Filter observations"
- ex-data-mutate : "Create new variables"
- ex-data-summarise : "Summarise Tables"
- ex-setup-r : "Set Up"
- hello : "Hello, Tutorial!"
- polyglot : "Multi-language exercises"
- quiz_question : "Tutorial Quiz Questions in `learnr`"
- setup-chunks : "Chained setup chunks"
- slidy : "Slidy demo"
- sql-exercise : "Interactive SQL Exercises"
I am looking for an option, like swirl
s MANIFEST file, which specifies the order.
Only if there is no such option I would resort to renaming the files.
There's no way to change the order unless you change the names. The code for learnr
finds tutorials by running list.dirs on the package folder And according to the ?list.dirs
help page "the files are sorted in alphabetical order, on the full path if full.names = TRUE." There's no current way to specify a manifest. You'd have to request a new feature from the package authors.