The data set I chose for my final project focuses on the characteristics and stats of over 700 Dungeons and Dragons monsters that was web scraped from AideDD.org . I chose this data set because I have taken a recent interest in DnD after a few of my friends introduced me to it a couple of weeks ago. The categorical variable of this data set are the monster name, the type of species of the monster, the size of the monster, the motivation alignment of the monster, the speed of the monster (which is whether it can walk, swim, and/or fly, not an actual value), whether the monster is legendary or not, and the source from which the monster was created for use in game. The quantitative variables in this data set are the monster’s challenge rating, their ac (how easy it is to hit them), their hit points, their strength, their dexterity, their constitution, their intelligence, their wisdom, and their charisma. Some questions I would like to answer with this data set are if a monster’s ac (Armor class) has a relationship with its hp (hit points) and if certain types of monsters have overall higher combat ratings than others.
Background Research
AideDD is an online resource used by many Dungeon’s and Dragon players across the globe. Not only does it have information on pretty much every character type, monster, campaign, and rule of the newest addition of Dungeons and Dragons (5e), it has a built in online character builder that allows you to customize every detail about a character you would like play as in your next DnD session. After you’ve created your character, selected your abilities, stats, items, and more, AideDD also allows exportation of a completed pdf file that you can use for your character whilst playing Dungeons and Dragons. Source
Warning: package 'plotly' was built under R version 4.2.3
Attaching package: 'plotly'
The following object is masked from 'package:ggplot2':
last_plot
The following object is masked from 'package:stats':
filter
The following object is masked from 'package:graphics':
layout
library(highcharter)
Warning: package 'highcharter' was built under R version 4.2.3
Registered S3 method overwritten by 'quantmod':
method from
as.zoo.data.frame zoo
Rows: 762 Columns: 17
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (9): name, url, cr, type, size, speed, align, legendary, source
dbl (8): ac, hp, str, dex, con, int, wis, cha
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Here I loaded in the necessary packages and the data set I plan on using for this project.
Here I cleaned up the data by removing both the URL and Guide Source variables, as these just relate to the origin of where these official monsters were created online or in a book, which won’t provide much insight for any analysis in this project. I also replaced the NA’s in the speed variable and legendary variable to better fit what those NA values are intending to represent, as these variable are categorical and the NA values actually indicate that they fall into a category not listed in the original variable, such as the NA is speed meaning the monster can only walk and the NA in legendary meaning the monster is not legendary.
Basic Visualizations
ggplot(dnd_monsters, aes(x = hp)) +geom_histogram(fill ="darkgreen", color ="black") +labs(title ="Distribution of Hit Points",x ="Hit Points",y ="Count")
`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Here I created a basic histogram to better understand the distribution of the hp variable
ggplot(dnd_monsters, aes(x = ac, y = size, fill = speed)) +geom_boxplot() +labs(title ="Distribution of Armor Class by Size",x ="Armor Class", y ="Size") +theme_minimal() +scale_fill_discrete(name ="Armor Class")
Here I created a boxplot of the ac variable grouped by size, and i filled the color of the boxplots by the speed of the monster.
Statistical Analysis
dnd_monsters_filter <-filter(dnd_monsters, !is.na(dnd_monsters$wis), !is.na(dnd_monsters$int))correlation <-cor(dnd_monsters_filter$int, dnd_monsters_filter$wis)cat("The correlation between wisdom and intelligence is", correlation)
The correlation between wisdom and intelligence is 0.6495574
For this statistical analysis I chose to see if a monster’s intelligence had a relationship with a monster’s wisdom, since even though they are different stats they function very similarly. From a correlation of 0.6495574, it shows that these two variables have a strong positive correlation, meaning that while there are other factors that affect these variable there appears to be a strong positive relationship between them.
Final Visualizaations
dnd_monsters$cr <-as.numeric(dnd_monsters$cr)
Warning: NAs introduced by coercion
plot_ly(dnd_monsters, x =~ac, y =~hp, color =~align, size =~cr,type ="scatter", mode ="markers", colors ="Set3") %>%add_markers(hoverinfo ="text",hovertext =~paste("Name: ", name, "<br>","Monster Type: ", type, "<br>","Combat Rating: ", cr, "<br>","Alignment: ", align, "<br>","Legendary?: ", legendary)) %>%layout(title ="Armor Class Versus Hipoints of DnD Monsters",xaxis =list(title ="Armor Class"),yaxis =list(title ="Hit Points"),legend =list(title ="Alignment"),colorway =c("#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd"),hovermode ="closest")
Warning: `line.width` does not currently support multiple values.
Warning: `line.width` does not currently support multiple values.
Warning: `line.width` does not currently support multiple values.
Warning: `line.width` does not currently support multiple values.
Warning: `line.width` does not currently support multiple values.
Warning: `line.width` does not currently support multiple values.
Warning: `line.width` does not currently support multiple values.
Warning: `line.width` does not currently support multiple values.
Warning: `line.width` does not currently support multiple values.
Warning: `line.width` does not currently support multiple values.
Warning: `line.width` does not currently support multiple values.
Warning: `line.width` does not currently support multiple values.
Warning: `line.width` does not currently support multiple values.
Warning: `line.width` does not currently support multiple values.
Warning: `line.width` does not currently support multiple values.
Warning: `line.width` does not currently support multiple values.
Warning: `line.width` does not currently support multiple values.
Warning: `line.width` does not currently support multiple values.
Warning: `line.width` does not currently support multiple values.
Warning: `line.width` does not currently support multiple values.
Warning: `line.width` does not currently support multiple values.
Warning: `line.width` does not currently support multiple values.
Warning: `line.width` does not currently support multiple values.
Warning: `line.width` does not currently support multiple values.
Warning: `line.width` does not currently support multiple values.
Warning: `line.width` does not currently support multiple values.
Warning: `line.width` does not currently support multiple values.
Warning: `line.width` does not currently support multiple values.
Warning: `line.width` does not currently support multiple values.
Warning: `line.width` does not currently support multiple values.
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
Warning in RColorBrewer::brewer.pal(n, pal): n too large, allowed maximum for palette Set3 is 12
Returning the palette you asked for with that many colors
In this visualization I wanted to compare ac, the ability of a monster to avoid getting hit, to the actual health of a monster. I used plotly to make this scatterplot, where the color of each point was based on the alignment of the monster and the size of the points were based off of combat rating.
`summarise()` has grouped output by 'cr'. You can override using the `.groups`
argument.
hchart(dnd_summary, "heatmap", hcaes(x = cr, y = type, value = mean_str)) %>%hc_colorAxis(minColor ="#FFFFFF", maxColor ="#7B1FA2") %>%hc_title(text ="DnD Monster Combat Ratings Based on Monster Type") %>%hc_xAxis(title =list(text ="Combat Rating")) %>%hc_yAxis(title =list(text ="Monster Type"))
This visualization is my first honest attempt at a heatmap using high charter. I created it to look at the distribution of combat rating based on the type of monster, and I added in a tooltip that shows the mean strength of the monster.
Conclusion
The scatterplot shows a positive correlation between a monster’s AC and HP, and its also interesting to see that as these two variable go up that combat rating seems to also increase, as the sizes of the dots increase the further away from the origin they are.
The heatmap reveals that most of the monsters in this data set have relatively low combat ratings, however there are some like construct that appear to have a higher combat rating distributions than the rest of the data.