Package 'rgrind'

Title: Gamified Algorithmic and Data Wrangling Challenges for R
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.
Authors: Uwakmfon Paul [aut, cre]
Maintainer: Uwakmfon Paul <[email protected]>
License: MIT + file LICENSE
Version: 0.1.0
Built: 2026-10-07 09:27:16 UTC
Source: https://github.com/devwebwacky/rgrind

Help Index


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()

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)

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 list_challenges() for all available ids.

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)