I am trying to filter out all introduced plant species (Native = N) from my data, except one (Cenchrus ciliaris).
Example data:
Example <- data.frame(Site = c('Q1','Q1','Q1','Q1','Q2','Q2','Q2','Q2','Q3','Q3','Q3','Q3'),
Taxon = c('Abutilon otocarpum', 'Acacia pyrifolia', 'Bidens bipinnata', 'Cenchrus ciliaris', 'Abutilon otocarpum','Aristida contorta','Bidens bipinnata','Cenchrus ciliaris','Acacia pyrifolia','Aristida contorta','Bidens bipinnata','Cenchrus ciliaris'),
Native = c('Y', 'Y','N','N','Y','Y','N','N','Y','Y','N','N'))
I can easily filter out ALL introduced species (e.g. first line below). It also seems I can do the opposite of what I'm after as the second line below gets rid of all Cenchrus ciliaris records.
filter(!Native %in% "N")
filter(!Native=="N" & Taxon =="Cenchrus ciliaris" | Taxon != "Cenchrus ciliaris")
Is it possible to use conditional formatting even though Cenchrus ciliaris contradicts the native plant rule? If not, I'm happy to use other alternatives!
Thanks in advance for any insight you can provide! :)
How about the following:
filter(Native=="Y" | Taxon =="Cenchrus ciliaris")