-
Notifications
You must be signed in to change notification settings - Fork 5
/
README.Rmd
90 lines (68 loc) · 2.38 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# parsons <img src='man/figures/parsons-logo.png' align="right" height="139" />
<!-- badges: start -->
[![Travis build status](https://travis-ci.org/rstudio/parsons.svg?branch=master)](https://travis-ci.org/rstudio/parsons)
[![CRAN version](http://www.r-pkg.org/badges/version/parsons)](https://cran.r-project.org/package=parsons)
[![parsons downloads per month](http://cranlogs.r-pkg.org/badges/parsons)](http://www.rpackages.io/package/parsons)
[![Codecov test coverage](https://codecov.io/gh/rstudio/parsons/branch/master/graph/badge.svg)](https://codecov.io/gh/rstudio/parsons?branch=master)
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)
<!-- badges: end -->
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](https://CRAN.R-project.org) with:~~
```r
~~install.packages("parsons")~~
```
And the development version from [GitHub](https://github.com/rstudio/parsons) with:
```r
# 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.
<center>
<img src="man/figures/parsons_app.gif" style = 'width:400px;'></img>
</center>
You can add a parsons problem to a `learnr` tutorial with the `question_parsons()` function:
```R
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'"
)
)
```