I have some measurement data for Central Texas lizards. Each lizards has several traits measured, is assigned a decade based on the year it was collected (these range from 1940-2010), and is associated with one of three distinct environmental categories-high urban (HU), low urban (LU), and rural (R). I am trying to create a boxplot that plots the measurement (I am using the measurement "svl" here as an example) by decade, but with each decade having three boxes for each environmental category (which is called "local"type" in my dataset). However, I am only getting one box per decade. How could I rectify this? Thanks.
library(ggplot2)
library(plyr)
olivaceus <- read.csv("FL_olivaceus_measurements_11-2-2020.csv")
View(olivaceus)
plot <- ggplot(olivaceus, aes(decade, svl, fill=local_type)) + geom_boxplot(na.rm = TRUE) + theme_classic() + stat_boxplot(geom = 'errorbar', width = 0.2)
plot