move_episode | R Documentation |
If you need to move a single episode, this function gives you a programmatic or interactive interface to accomplishing this task, whether you need to add and episode, draft, or remove an episode from the schedule.
move_episode(ep = NULL, position = NULL, write = FALSE, path = ".")
ep |
the name of a draft episode or the name/number of a published episode to move. |
position |
the position in the schedule to move the episode. Valid positions are from 0 to the number of episodes (+1 for drafts). A value of 0 indicates that the episode should be removed from the schedule. |
write |
defaults to |
path |
the path to the lesson (defaults to the current working directory) |
create_episode()
, set_episodes()
, get_drafts()
, get_episodes()
if (interactive() || Sys.getenv("CI") != "") {
tmp <- tempfile()
create_lesson(tmp)
create_episode_md("getting-started", path = tmp, open = FALSE)
create_episode_rmd("plotting", path = tmp, open = FALSE)
create_episode_md("experimental", path = tmp, add = FALSE, open = FALSE)
set_episodes(tmp, c("getting-started.md", "introduction.Rmd", "plotting.Rmd"),
write = TRUE)
# Default episode order is alphabetical, we can use this to nudge episodes
get_episodes(tmp)
move_episode("introduction.Rmd", 1L, path = tmp) # by default, it shows you the change
move_episode("introduction.Rmd", 1L, write = TRUE, path = tmp) # write the results
get_episodes(tmp)
# Add episodes from the drafts
get_drafts(tmp)
move_episode("experimental.md", 2L, path = tmp) # view where it will live
move_episode("experimental.md", 2L, write = TRUE, path = tmp)
get_episodes(tmp)
# Unpublish episodes by setting position to zero
move_episode("experimental.md", 0L, path = tmp) # view the results
move_episode("experimental.md", 0L, write = TRUE, path = tmp)
get_episodes(tmp)
# Interactively select the position where the episode should go by omitting
# the position argument
if (interactive()) {
move_episode("experimental.md", path = tmp)
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.