datacamp (version 3.3.0)

add_exercise: Add exercise to chapter file

Description

Add exercise to chapter file

Usage

add_exercise(chapter_file, lang, type = c("NormalExercise",
  "MultipleChoiceExercise", "VideoExercise", "RStudioMultipleChoiceExercise",
  "ShinyNormalExercise"), title = NULL, content = NULL)

Arguments

chapter_file

path to the chapter you want to append a template to

lang

The programming language of the exercises in the template

type

type of the exercise you want to add a template for (default is "NormalExercise")

title

Title of the exercise

content

Short summary of the exercise (will be filled in in assignment part)

Examples

Run this code
# NOT RUN {
add_exercise("chapter1.Rmd", lang = "r", type = "NormalExercise")
add_exercise("chapter1.Rmd", lang = "r", type = "MultipleChoiceExercise")
add_exercise("chapter1.Rmd", lang = "r", type = "VideoExercise")
add_exercise("chapter1.Rmd", lang = "r", type = "NormalExercise",
             title = "My Normal Exercise", content = "This is a normal exercise.")
add_exercise("chapter1.Rmd", lang = "r", type = "MultipleChoiceExercise")
             title = "My Multiple Choice Exercise", content = "This is an MCE.")
add_exercise("chapter1.Rmd", lang = "r", type = "VideoExercise",
             title = "My Video", content = "This video discusses interesting things.")

add_exercise("chapter1.md", lang = "python", type = "NormalExercise")
add_exercise("chapter1.md", lang = "python", type = "MultipleChoiceExercise")
add_exercise("chapter1.md", lang = "python", type = "VideoExercise")
add_exercise("chapter1.md", lang = "python", type = "NormalExercise",
             title = "My Normal Exercise", content = "This is a normal exercise.")
add_exercise("chapter1.md", lang = "python", type = "MultipleChoiceExercise")
             title = "My Multiple Choice Exercise", content = "This is an MCE.")
add_exercise("chapter1.md", lang = "python", type = "VideoExercise",
             title = "My Video", content = "This video discusses interesting things.")
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab