Learn R Programming

dndR: Dungeons & Dragons Functions for Players and Dungeon Masters

The goal of dndR is to provide a suite of Dungeons & Dragons (Fifth Edition a.k.a. “5e”) related functions to help both players and Dungeon Masters (DMs). Check out the package website (njlyon0.github.io/dndR) for documentation of the functions currently included in the package. I am always willing to expand that list though so if you have a D&D-related task that could be cool as a function, please post it as an Issue on this package’s GitHub repository!

Installation

You can install the development version of dndR from GitHub with:

# install.packages("devtools")
devtools::install_github("njlyon0/dndR")

Contributing to dndR

If you’d like to contribute function scripts or ideas, that is more than welcome! For specific instructions check out CONTRIBUTING.md but at a glance:

Package Contributors

Copy Link

Version

Install

install.packages('dndR')

Monthly Downloads

402

Version

3.0.0

License

MIT + file LICENSE

Maintainer

Nicholas J Lyon

Last Published

April 2nd, 2025

Functions in dndR (3.0.0)

d8

Roll an Eight-Sided Dice ("d8")
d3

Roll a Three-Sided Dice
d20

Roll a Twenty-Sided Dice ("d20")
pc_level_calc

Calculate Player Character (PC) Level from Current Experience Points (XP)
pc_creator

Create a Player Character (PC)
npc_creator

Create a Non-Player Character (NPC)
spell_list

List Spells Based on Criteria
d4

Roll a Four-Sided Dice ("d4")
party_diagram

Generate a Diagram of a Party's Ability Scores
d6

Roll a Six-Sided Dice ("d6")
spell_text

Retrieve Full Spell Description Text by Spell Name
xp_pool

Calculate Total XP of Monsters for Given Party Level and Difficulty
monster_creator

Creates a Monster for Given Party Level and Size
mod_calc

Calculate Modifier for Specified Ability Score
dnd_races

Return Vector of Supported DnD Races
encounter_creator

Balance a Combat Encounter for Given Party Composition and Difficulty
monster_stats

Quickly Identify Monster Statistics
reroll

Re-Roll 1s from a Prior Dice Roll
roll

Roll Any Number of Dice
spells

Dungeons and Dragons Spell Information
xp_cost

Adjust the XP Total by Number of Monsters and Party Size
monster_table

Dungeons and Dragons Quick Table for Creature Statistics
d2

Roll a Two-Sided Dice
d12

Roll a Twelve-Sided Dice ("d12")
race_mods

Identify Race-Based Ability Modifiers
probability_plot

Generate a Plot of the Frequency of Roll Outcomes
class_block

Assign Ability Scores Based on Class
ability_scores

Roll for All Ability Scores
d10

Roll a Ten-Sided Dice ("d10")
d100

Roll a One Hundred-Sided Dice ("d100")
ability_singular

Rolls for a Single Ability Score
creatures

Dungeons and Dragons Creature Information
creature_text

Retrieve Full Creature Description Text by Creature Name
dnd_classes

Return Vector of Accepted Classes
cr_convert

Convert Challenge Rating to Experience Points
coin

Flip a Coin
dnd_damage_types

Return Vector of Supported DnD Damage Types
dndR-package

dndR: Dungeons & Dragons Functions for Players and Dungeon Masters
creature_list

List Creatures Based on Criteria