Skip to content

rstudio/tblcheck

Repository files navigation

tblcheck tblcheck hex logo

CRAN status R-CMD-check

tblcheck provides functions for grading tibbles, data frames, and vectors with gradethis.

gradethis is designed for use with gradethis in learnr tutorials. We recommend that you first be comfortable grading learnr tutorials with gradethis before you begin using tblcheck. You can learn more with the gradethis package documentation and the learnr package documentation.

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.'

Installation

tblcheck is still in development and not on CRAN yet. The development version of tblcheck can be installed from GitHub with:

# 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:

```{r setup}
library(learnr)
library(gradethis)
library(tblcheck)
library(tibble)
```

Then include one of the tblcheck functions in your gradethis code:

```{r exercise, exercise = TRUE}

```

```{r exercise-solution}
tibble(fruit = "tomato", color = "red")
```

```{r exercise-check}
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. By contributing to this project, you agree to abide by its terms.