include_exercise | R Documentation |
Each exercise is contained in its own file, with a unique ID. This function
reads the file for that ID, knits the contents, and returns the knitted contents.
Typically this will be used to insert the exercise into an Rmd file.
If not specified, argument show_answer
will be read from options("show_answer")
.
include_exercise( id, show_answer = getOption("show_exercise", TRUE), verbose = TRUE, directory = "Exercises", prob_name = "Problem XX", format = ifelse(knitr::is_latex_output(), "latex", "html") )
id |
the unique ID of the exercise file. Don't include the file type suffix ".Rmd" in the id. |
show_answer |
if TRUE, include the answer comments from the file. |
verbose |
Include the YAML information |
directory |
the directory where the exercise file is to be found |
prob_name |
Character string naming the problem, e.g. |
When output is in html, use the answer-fragment
class in CSS to format
the answers.
the_testing_dir <- system.file("Test_exercises", package = "SDSdata") include_exercise("beech-run-mug", directory = the_testing_dir, format = "latex")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.