| Type: | Package |
| Title: | Gamified Algorithmic and Data Wrangling Challenges for R |
| Version: | 0.1.0 |
| Description: | An in-console, gamified learning and practice engine for R. Solve algorithmic and data-wrangling challenges directly in the R console, get instant styled feedback with worked explanations, and track your progress locally with a solving streak, attempt history, and an activity heatmap. |
| License: | MIT + file LICENSE |
| Encoding: | UTF-8 |
| Imports: | cli |
| Config/roxygen2/version: | 8.1.0 |
| Suggests: | knitr, rmarkdown, testthat (≥ 3.0.0), tibble |
| Config/testthat/edition: | 3 |
| URL: | https://devwebwacky.github.io/rgrind/ |
| VignetteBuilder: | knitr |
| NeedsCompilation: | no |
| Packaged: | 2026-09-24 23:36:27 UTC; Wacky |
| Author: | Uwakmfon Paul [aut, cre] |
| Maintainer: | Uwakmfon Paul <uwakmfon31@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-10-06 07:40:09 UTC |
Look up a challenge by id
Description
Look up a challenge by id
Usage
get_challenge(challenge_id)
List all available challenge ids
Description
Returns the ids of every challenge currently registered in the
package. Use an id with run_challenge() to attempt that challenge.
Usage
list_challenges()
Value
A character vector of challenge ids.
Examples
list_challenges()
Register a challenge into the internal registry
Description
Register a challenge into the internal registry
Usage
register_challenge(challenge)
Compare actual vs expected output for grading, ignoring superficial differences (class, row order, attributes) while enforcing real ones (column names, values).
Description
Compare actual vs expected output for grading, ignoring superficial differences (class, row order, attributes) while enforcing real ones (column names, values).
Usage
rg_check_equal(actual, expected, ignore_row_order = TRUE, tolerance = NULL)
rg_check_equal(actual, expected, ignore_row_order = TRUE, tolerance = NULL)
Arguments
actual |
The user's function output. |
expected |
The correct/reference output. |
ignore_row_order |
Logical. If TRUE (default), rows can be in any order. Set FALSE for problems where order is part of the answer. |
tolerance |
Numeric or NULL. If provided, numeric comparisons allow differences up to this tolerance instead of requiring exact equality. Useful for challenges involving randomness (e.g. bootstrap). Ignored for data frame column-name checks. |
Value
TRUE if equal under our grading rules, otherwise a character string explaining what didn't match (so it can be shown in feedback).
Get your full local challenge attempt history
Description
Returns every attempt you've made across all challenges, including both passes and failures, stored locally on your machine.
Usage
rg_get_history()
Value
A data frame with columns challenge_id, timestamp, and
passed.
Examples
old_opt <- options(rgrind.storage_dir = tempdir())
rg_get_history()
options(old_opt)
Get your current solving streak
Description
Calculates how many consecutive days (ending today or yesterday) you've passed at least one challenge. A streak is still considered active if you solved something yesterday but haven't yet today.
Usage
rg_get_streak()
Value
An integer: the current streak length in days.
Examples
old_opt <- options(rgrind.storage_dir = tempdir())
rg_get_streak()
options(old_opt)
Show a 28-day activity heatmap
Description
Prints a simple ASCII grid showing how many challenges you passed each day over the last 28 days, similar in spirit to GitHub's contribution graph.
Usage
rg_heatmap()
Value
Invisibly, a character vector of the rendered symbols.
Examples
old_opt <- options(rgrind.storage_dir = tempdir())
rg_heatmap()
options(old_opt)
Log a single challenge attempt
Description
Log a single challenge attempt
Usage
rg_log_attempt(challenge_id, passed)
Calculate the longest streak ever achieved (not just the current one)
Description
Calculate the longest streak ever achieved (not just the current one)
Usage
rg_longest_streak()
Clear your local challenge history
Description
Permanently deletes your locally stored attempt history, including streak data. This cannot be undone.
Usage
rg_reset_history()
Value
Invisibly, TRUE.
Examples
old_opt <- options(rgrind.storage_dir = tempdir())
rg_reset_history()
options(old_opt)
Show a summary of your overall rgrind progress
Description
Prints how many challenges you've solved, your total attempts, and your current and longest solving streaks.
Usage
rg_stats()
Value
Invisibly, a list with solved, total_challenges,
attempts, current_streak, and longest_streak.
Examples
old_opt <- options(rgrind.storage_dir = tempdir())
rg_stats()
options(old_opt)
Run an rgrind puzzle against your own solution
Description
Tests a user-submitted function against a challenge's test cases, printing styled pass/fail feedback to the console. On a full pass, shows an explanation of the idiomatic solution and updates your local solving streak. On any failure, shows details for the failed tests and a hint.
Usage
run_challenge(challenge_id, user_fun)
Arguments
challenge_id |
Character. The id of the challenge to run.
See |
user_fun |
Function. Your own solution to test — written and defined in your own R session, then passed in directly. |
Value
Invisibly, a list with passed (number of test cases
passed) and total (total number of test cases).
Examples
old_opt <- options(rgrind.storage_dir = tempdir())
my_solution <- function(x) sum(x[x %% 2 == 0], na.rm = TRUE)
run_challenge("sum_evens", my_solution)
options(old_opt)