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 review the contributing guidelines on how to share your idea!

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! Please check out the contributing guidelines and follow the instructions described there.

Package Contributors

Copy Link

Version

Install

install.packages('dndR')

Monthly Downloads

327

Version

3.1.0

License

MIT + file LICENSE

Maintainer

Nicholas J Lyon

Last Published

June 11th, 2025

Functions in dndR (3.1.0)

d4

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

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

Return Vector of Feminine First Names
npc_creator

Create a Non-Player Character (NPC)
first_names_masc

Return Vector of Masculine First Names
spell_list

List Spells Based on Criteria
surnames

Return Vector of Surnames
spells

Dungeons and Dragons Spell Information
party_diagram

Generate a Diagram of a Party's Ability Scores
pc_creator

Create a Player Character (PC)
dnd_races

Return Vector of Supported DnD Races
encounter_creator

Balance a Combat Encounter for Given Party Composition and Difficulty
pc_level_calc

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

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

Roll a Two-Sided Dice
mod_calc

Calculate Modifier for Specified Ability Score
spell_text

Retrieve Full Spell Description Text by Spell Name
monster_creator

Creates a Monster for Given Party Level and Size
probability_plot

Generate a Plot of the Frequency of Roll Outcomes
race_mods

Identify Race-Based Ability Modifiers
dnd_damage_types

Return Vector of Supported DnD Damage Types
dnd_classes

Return Vector of Accepted Classes
monster_table

Dungeons and Dragons Quick Table for Creature Statistics
roll

Roll Any Number of Dice
xp_cost

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

Re-Roll 1s from a Prior Dice Roll
monster_stats

Quickly Identify Monster Statistics
xp_pool

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

List Creatures Based on Criteria
class_block

Assign Ability Scores Based on Class
d100

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

Convert Challenge Rating to Experience Points
creatures

Dungeons and Dragons Creature Information
d10

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

Flip a Coin
ability_scores

Roll for All Ability Scores
ability_singular

Rolls for a Single Ability Score
creature_text

Retrieve Full Creature Description Text by Creature Name
d20

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

Roll a Three-Sided Dice
d8

Roll an Eight-Sided Dice ("d8")
dndR-package

dndR: Dungeons & Dragons Functions for Players and Dungeon Masters