wq_script: Template for R script question

Description Usage Arguments Examples

Description

Template for R script question

Usage

1
2
3
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## 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 documentation built on May 28, 2019, 9:02 a.m.