I have a data frame that I'm using called "fish".
The data frame has 3 different variables. One of the variables is called "species".
There are some species that start with the letter M. I want to change all the values of species that start with the letter M to be missing (NA) instead.
I know how to change it to NA when you are doing the whole species name, but how do you do it for just species that START with the letter M?
I've tried this:
fish$species[fish$species=="^M_"] <- NA
But this doesn't work. Can anyone help?