Data: I have a list of specimens that have been taxonomically identified (noted as 'Genus", and assigned as either Maastrichtian or Danian in age (noted as 'Preliminary ID'). Example: Specimen #5 is identified as Adocus, and its from the Danian. There's about 15 different genera, and two age options.
Goal: I would like to make a boxplot that pairs the overall percentage that each genus makes up of the Maastrichtian assemblage, and the Danian Assemblage. I have way more Maastrichtian specimens than Danian ones, so I need to normalize this data (ie. Adocus makes up 10% of total Danian turtles, Aspideretoides makes up 20% of total Maastrichtian samples, etc)
I'm using this tutorial: https://www.youtube.com/watch?v=Er-tXfGkL08&t=724s
Here is my code:
my_data%>%
drop_na(`Preliminary ID`)%>%
drop_na(Genus)%>%
ggplot(aes(Genus,fill(`Preliminary ID`)))
geom_bar(position="dodge",
alpha(0.5))+
labs(title="Maastrichtian Vs Danian Turtle Assemblage",
x="Genus",
y="Number")+
theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))
`` `
**Error Message:**
my_data%>%
- drop_na(
Preliminary ID
)%>% - drop_na(Genus)%>%
- ggplot(aes(Genus,fill(
Preliminary ID
)))
Error ingeom_blank()
:
! Problem while computing aesthetics.
Error occurred in the 1st layer.
Caused by error inUseMethod()
:
! no applicable method for 'fill' applied to an object of class "character"
Runrlang::last_error()
to see where the error occurred.