-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME.Rmd
90 lines (63 loc) · 3.98 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%"
)
```
# tblcheck <img alt="tblcheck hex logo" src='man/figures/logo.png' align="right" height="120" />
<!-- badges: start -->
[](https://CRAN.R-project.org/package=tblcheck)
[](https://github.com/rstudio/tblcheck/actions)
<!-- [](https://cran.r-project.org/package=tblcheck) -->
<!-- badges: end -->
tblcheck provides functions for grading tibbles, data frames, and vectors with [gradethis](https://pkgs.rstudio.com/gradethis/).
gradethis is designed for use with [gradethis](https://pkgs.rstudio.com/gradethis/) in [learnr](https://rstudio.github.io/learnr/) tutorials. We recommend that you first be comfortable grading [learnr](https://rstudio.github.io/learnr/) tutorials with [gradethis](https://pkgs.rstudio.com/gradethis/) before you begin using tblcheck. You can learn more with the [gradethis package documentation](https://pkgs.rstudio.com/gradethis/) and the [learnr package documentation](https://rstudio.github.io/learnr/).
<img src="man/figures/screenshot.png" alt="A screenshot of the tblcheck package in action. An exercise starts with the following instructions: 'Create a tibble with two columns. The first column should be called "fruit" and contain the value "tomato". The second column should be called "color" and contain the value "red".' The student has entered the following code: 'tibble(vegetable = "tomato", color = "red")'. The tblcheck package generates the following message: 'Your table should have a column named "fruit". Your table should not have a column named "vegetable". Please try again.'" style="border: 1px solid black; box-shadow: 5px 5px 5px #eee; max-width: 66%; display: block; margin: 1em auto;">
## Installation
<!-- You can install the released version of tblcheck from [CRAN](https://CRAN.R-project.org) with: -->
<!-- ``` r -->
<!-- install.packages("tblcheck") -->
<!-- ``` -->
tblcheck is still in development and not on [CRAN](https://CRAN.R-project.org) yet. The development version of tblcheck can be installed from GitHub with:
``` r
# install.packages("remotes")
remotes::install_github("rstudio/tblcheck")
```
## Usage
To use tblcheck in a learnr tutorial, start by loading tblcheck after learnr and gradethis in the `setup` chunk of your tutorial:
```` markdown
```{r setup}`r ""`
library(learnr)
library(gradethis)
library(tblcheck)
library(tibble)
```
````
Then include one of the tblcheck functions in your gradethis code:
```` markdown
```{r exercise, exercise = TRUE}`r ""`
```
```{r exercise-solution}`r ""`
tibble(fruit = "tomato", color = "red")
```
```{r exercise-check}`r ""`
grade_this_table()
```
````
`grade_this_table()` compares the `.result` generated by a students' code to the `.solution` generated in the `exercise-solution` chunk.
- `grade_this_table()` passes the student's `.result` if it's identical to the `.solution`,
or if a difference is detected, it produces a failing grade
with a message describing the problem with the table.
- `grade_this_table()` is built on gradethis functions and `tbl_grade()`,
which can be used in exercise grading code to detect problems in tables.
- `tbl_grade()`, in turn, is built on lower-level functions that can be used directly
to compare specific aspects of two tables.
Learn more about the various tblcheck functions in `vignette("tblcheck")`.
## Code of Conduct
Please note that the tblcheck project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.