如何使`learnr`教程按特定顺序显示?

huangapple go评论67阅读模式
英文:

How to make `learnr` tutorials appear in a certain order?

问题

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?

在使用learnr教程制作R包时,是否有一种方法可以使它们按照用户定义的顺序而不是按字母顺序显示?

I am looking for an option, like swirls MANIFEST file, which specifies the order.
Only if there is no such option I would resort to renaming the files.

我正在寻找一种选项,类似于swirl的MANIFEST文件,可以指定顺序。只有在没有这样的选项的情况下,我才会考虑重命名文件。

英文:

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 swirls MANIFEST file, which specifies the order.
Only if there is no such option I would resort to renaming the files.

答案1

得分: 1

没有办法改变顺序,除非你改变名称。 learnr 代码通过在包文件夹上运行 list.dirs 来查找教程。根据 ?list.dirs 帮助页面的说明,“如果 full.names = TRUE,则按照完整路径按字母顺序排序文件。” 目前没有办法指定清单。你需要向包的作者请求一个新的功能。

英文:

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.

huangapple
  • 本文由 发表于 2023年4月17日 21:48:53
  • 转载请务必保留本文链接:https://go.coder-hub.com/76035871.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定