fish497-2018 / Jarvis_ReefFish

0 stars 0 forks source link

How to Graph these Data? #3

Closed raegan13 closed 6 years ago

raegan13 commented 6 years ago

In my question, I'm attempting to compare the amount of species present in Bootless Bay and the Museum Bootless collection. The data notes absence/presence of each species as 0/1. I'm having a really hard time thinking of how I can graph this data effectively. Does anyone have an idea of what I could do?

sr320 commented 6 years ago

not exactly what you are looking for but I pushed code to count each fish from each genus at each site.

#count fish at each site based on genus, listing number of species
group_by(reef_fish_bootless, Genus) %>%
  summarise(
    bootless = sum(Bootless),
    Museum.Bootless = sum(Museum.Bootless),
    n_species = n())
sr320 commented 6 years ago

More directly you could filter rows based on value > 0 and count number of rows for each location

raegan13 commented 6 years ago

Great, thanks for the help!

raegan13 commented 6 years ago

Next question: I want to filter out rows that are only 0 for both Bootless and Museum.Bootless, but not rows that read 0 for only one location. Is there a way to use filter() for conditions like this?

sr320 commented 6 years ago
dataset %>% 
filter(Bootless == 1 & Museum.Bootless == 1) 

or

dataset %>% 
filter(Bootless != 0 & Museum.Bootless != 0) 
raegan13 commented 6 years ago

Thanks so much! I figured out a way to do it using "|".