I have a dataframe;
vessel<-c(letters[1:4])
type<-c("Fishery Vessel","NA","NA","Cargo")
class<-c("NA","FISHING","NA","CARGO")
status<-c("NA", "NA", "Engaged in Fishing", "Underway")
df<-data.frame(vessel,type, class, status)
vessel           type   class             status
1      a Fishery Vessel      NA                 NA
2      b             NA FISHING                 NA
3      c             NA      NA Engaged in Fishing
4      d          Cargo   CARGO           Underway
I would like to subset the df to contain only those rows relating to fishing (ie rows 1:3) so that means to me doing something like;
df.sub<-subset(grep("FISH", df) | grep("Fish", df))
But this doesn't work.  I've been trialing apply (such as this question) or partial string matching using grep (like this question) but I can't seem to pull it all together.
Grateful for any help. My data is 10s of columns and up to a million rows, so trying my best to avoid loops if possible but maybe that's the only way? Thanks!
 
     
     
     
    