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")
#> → Creating Lesson in /tmp/RtmpP9eYUD/file193244794b4e...
#>  No schedule set, using Rmd files in episodes/ directory.
#> → Creating Lesson in /tmp/RtmpP9eYUD/file193244794b4e...

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

#> ────────────────────────────────────────────────────────────────────────
#> → Creating Lesson in /tmp/RtmpP9eYUD/file193244794b4e...

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

#>  First episode created in /tmp/RtmpP9eYUD/file193244794b4e/episodes/introduction.Rmd
#> → Creating Lesson in /tmp/RtmpP9eYUD/file193244794b4e...

#>  Workflows up-to-date!
#> → Creating Lesson in /tmp/RtmpP9eYUD/file193244794b4e...

#>  Consent to use package cache provided
#> → Creating Lesson in /tmp/RtmpP9eYUD/file193244794b4e...

#> - The project is out-of-sync -- use `renv::status()` for details.
#> → Searching for and installing available dependencies
#> The following packages were discovered:
#> 
#> # ~/work/_temp/Library -------------------------------------------------------
#> - R6            2.5.1
#> - base64enc     0.1-3
#> - bslib         0.7.0
#> - cachem        1.1.0
#> - cli           3.6.3
#> - digest        0.6.36
#> - evaluate      0.24.0
#> - fastmap       1.2.0
#> - fontawesome   0.5.2
#> - fs            1.6.4
#> - glue          1.7.0
#> - highr         0.11
#> - htmltools     0.5.8.1
#> - jquerylib     0.1.4
#> - jsonlite      1.8.8
#> - knitr         1.48
#> - lifecycle     1.0.4
#> - memoise       2.0.1
#> - mime          0.12
#> - rappdirs      0.3.3
#> - rlang         1.1.4
#> - rmarkdown     2.27
#> - sass          0.4.9
#> - tinytex       0.52
#> - xfun          0.46
#> - yaml          2.3.10
#> 
#> They will be copied into the project library.
#> 
#> - Copying packages into the project library ... Done!
#> - Hydrated 26 packages in 0.21 seconds.
#> - Resolving missing dependencies ... 
#> # Installing packages --------------------------------------------------------
#> - The project is out-of-sync -- use `renv::status()` for details.
#> → Recording changes in lockfile
#> The following package(s) will be updated in the lockfile:
#> 
#> # GitHub ---------------------------------------------------------------------
#> - renv          [* -> rstudio/renv]
#> 
#> # https://packagemanager.posit.co/cran/__linux__/jammy/latest ----------------
#> - R6            [* -> 2.5.1]
#> - base64enc     [* -> 0.1-3]
#> - bslib         [* -> 0.7.0]
#> - cachem        [* -> 1.1.0]
#> - cli           [* -> 3.6.3]
#> - digest        [* -> 0.6.36]
#> - evaluate      [* -> 0.24.0]
#> - fastmap       [* -> 1.2.0]
#> - fontawesome   [* -> 0.5.2]
#> - fs            [* -> 1.6.4]
#> - glue          [* -> 1.7.0]
#> - highr         [* -> 0.11]
#> - htmltools     [* -> 0.5.8.1]
#> - jquerylib     [* -> 0.1.4]
#> - jsonlite      [* -> 1.8.8]
#> - knitr         [* -> 1.48]
#> - lifecycle     [* -> 1.0.4]
#> - memoise       [* -> 2.0.1]
#> - mime          [* -> 0.12]
#> - rappdirs      [* -> 0.3.3]
#> - rlang         [* -> 1.1.4]
#> - rmarkdown     [* -> 2.27]
#> - sass          [* -> 0.4.9]
#> - tinytex       [* -> 0.52]
#> - xfun          [* -> 0.46]
#> - yaml          [* -> 2.3.10]
#> 
#> The version of R recorded in the lockfile will be updated:
#> - R             [* -> 4.4.1]
#> 
#> - Lockfile written to "/tmp/RtmpP9eYUD/file193244794b4e/renv/profiles/lesson-requirements/renv.lock".
#>  Lesson successfully created in /tmp/RtmpP9eYUD/file193244794b4e
#> → Creating Lesson in /tmp/RtmpP9eYUD/file193244794b4e...

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

# reverse the schedule
set_episodes(tmp, order = rev(sched))
#> episodes:
#> - using-r.Rmd
#> - introduction.Rmd
#> 
#> ────────────────────────────────────────────────────────────────────────
#>  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.Rmd"