This code creates a graph with year on the x-axis and proportion of observations (per checklist) that are yellow warblers.
erd.yelwar = erd %>% select(checklist_id, longitude, latitude, year, yelwar)
Create tibble with number of checklists where yelwar > 0 and total number of checklists
Number of columns where yelwar > 0
I am trying to plot ratio:
number of checklists where yelwar > 0 / total number of checklists.
The total number of checklists:
total_check = length(erd.yelwar$checklist_id)
filter data so only include yelwar > 0 then group by year then calcuate proportion of yelwar > 0 per checklist per year
erd.yelwar.grtr0 = erd.yelwar %>% filter (yelwar > 0) %>% group_by(year) %>%
mutate(prop.yelwar = length(yelwar) /total_check)
ggplot(erd.yelwar.grtr0,aes(x=year,y=prop.yelwar)) +
geom_point() +
labs(x = "", title = "proportion of checklists that observed yellow warblers")
Gather in groups of species (I had to do this in chunks otherwise I got an error saying I’d max’d my vector limit) with number of detections per species per checklist.
Concatenate groups
Create tibble with proportion of yewa observations per total observations by year