Skip to contents

Set the order of items in a dropdown menu

Usage

set_dropdown(path = ".", order = NULL, write = FALSE, folder)

set_episodes(path = ".", order = NULL, write = FALSE)

set_learners(path = ".", order = NULL, write = FALSE)

set_instructors(path = ".", order = NULL, write = FALSE)

set_profiles(path = ".", order = NULL, write = FALSE)

Arguments

path

path to the lesson. Defaults to the current directory.

order

the files in the order presented (with extension)

write

if TRUE, the schedule will overwrite the schedule in the current file.

folder

one of four folders that sandpaper recognises where the files listed in order are located: episodes, learners, instructors, profiles.

Examples


tmp <- tempfile()
create_lesson(tmp, "test lesson", open = FALSE, rmd = FALSE)
#> → Creating Lesson in /tmp/Rtmp8upEuX/file17133f2fc073...
#>  No schedule set, using Rmd files in episodes/ directory.
#> → Creating Lesson in /tmp/Rtmp8upEuX/file17133f2fc073...

#> To remove this message, define your schedule in config.yaml or use `set_episodes()` to generate it.
#> → Creating Lesson in /tmp/Rtmp8upEuX/file17133f2fc073...

#> ────────────────────────────────────────────────────────────────────────
#> → Creating Lesson in /tmp/Rtmp8upEuX/file17133f2fc073...

#>  To save this configuration, use
#> 
#> set_episodes(path = path, order = ep, write = TRUE)
#> → Creating Lesson in /tmp/Rtmp8upEuX/file17133f2fc073...

#>  Edit /tmp/Rtmp8upEuX/file17133f2fc073/episodes/introduction.md.
#> → Creating Lesson in /tmp/Rtmp8upEuX/file17133f2fc073...

#>  First episode created in /tmp/Rtmp8upEuX/file17133f2fc073/episodes/introduction.md
#> → Creating Lesson in /tmp/Rtmp8upEuX/file17133f2fc073...

#>  Workflows up-to-date!
#> → Creating Lesson in /tmp/Rtmp8upEuX/file17133f2fc073...

#>  Lesson successfully created in /tmp/Rtmp8upEuX/file17133f2fc073
#> → Creating Lesson in /tmp/Rtmp8upEuX/file17133f2fc073...

#> /tmp/Rtmp8upEuX/file17133f2fc073
# Change the title and License
set_config(c(title = "Absolutely Free Lesson", license = "CC0"),
  path = tmp,
  write = TRUE
)
#>  Writing to /tmp/Rtmp8upEuX/file17133f2fc073/config.yaml
#> → title: 'test lesson' -> title: 'Absolutely Free Lesson'
#> → license: 'CC-BY 4.0' -> license: 'CC0'
create_episode("using-R", path = tmp, open = FALSE)
#>  Edit /tmp/Rtmp8upEuX/file17133f2fc073/episodes/using-r.Rmd.
#> /tmp/Rtmp8upEuX/file17133f2fc073/episodes/using-r.Rmd
print(sched <- get_episodes(tmp))
#> [1] "introduction.md" "using-r.Rmd"    

# reverse the schedule
set_episodes(tmp, order = rev(sched))
#> episodes:
#> - using-r.Rmd
#> - introduction.md
#> 
#> ────────────────────────────────────────────────────────────────────────
#>  To save this configuration, use
#> 
#> set_episodes(path = tmp, order = rev(sched), write = TRUE)
# write it
set_episodes(tmp, order = rev(sched), write = TRUE)

# see it
get_episodes(tmp)
#> [1] "using-r.Rmd"     "introduction.md"