Skip to content

Latest commit

 

History

History
87 lines (68 loc) · 2.21 KB

README.md

File metadata and controls

87 lines (68 loc) · 2.21 KB

parsons

Travis build status CRAN version parsons downloads per month Codecov test coverage Lifecycle: experimental

Use the parsons package to create Parsons problems for teaching progamming. You can create custom questions in your learnr tutorials.

Installation

You can install the released version of parsons from CRAN with:

~~install.packages("parsons")~~

And the development version from GitHub with:

# install.packages("remotes")
remotes::install_github("rstudio/parsons")

Examples

Parsons problems

A Parsons problem is a specific type of question, useful for teaching programming, where all the lines of code are given, but the student must provide the correct order.

The parsons() function has experimental support for parsons problems.

You can add a parsons problem to a learnr tutorial with the question_parsons() function:

question_parsons(
  initial = c(
    "iris",
    "mutate(...)",
    "summarize(...)",
    "print()"
  ),
  pass_if(
    c(
      "iris",
      "mutate(...)",
      "summarize(...)"
    )
  ),
  fail_if(
    ~length(.) < 2,
    message = "Include at least two answers"
  ),
  fail_if(
    function(x){"print()" %in% x},
    message = "You should not include print() in your answer"
  ),
  fail_if(
    ~{.[1] != "iris"},
    message = "Your solution should start with 'iris'"
  )
)