Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

wq_script

Template for R script question


Description

Template for R script question

Usage

wq_script(output = "explain what the user must do here",
  answer_tests = "custom_test_name()", hint = "hint",
  script = "script-name.R")

Arguments

output

Text that is displayed to the user.

answer_tests

An internal function from swirl for testing the user's choice. See AnswerTests.

hint

A string that is printed to the console if the user answers this question incorrectly.

script

The name of the script template to be opened. This template should be in a directory called scripts located inside the lesson directory.

Examples

## Not run: 
# While writing a new lesson by hand just use:
wq_script()

# If converting from another format to a swirl course you may want to sue the
# API:
wq_script("Write a function that adds three numbers.",
 "add_three_test()", "Something like: add3 <- function(x, y, z){x+y+z}", 
 "add-three.R")

## End(Not run)

swirlify

A Toolbox for Writing 'swirl' Courses

v0.5.3
MIT + file LICENSE
Authors
Sean Kross [aut, cre], Nick Carchedi [aut], Chih-Cheng Liang [ctb], Wush Wu [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.