I am trying to omit rows of data based on partial matches an example of my data (seal_dist) is below:
A quick break down of my coding and why I need to answer this - I am dealing with a colony of seals where for example A1 is a female with pup and A1.1 is that female's pup, the important part of the data here is DIST which tells the distance between one seal (ID) and another (TO_ID). What I want to do is take a mean for these data for a nearest neighbour analysis but I want to omit any cases where there is the distance between a female and her pup, i.e. in the previous e.g. omit rows where A1 and A1.1 occur.
I have looked at grep and pmatch but these appear to work across columns and don't appear to do what I'm looking to do,
If anyone can point me in the right direction, I'd be most greatful,
Thanks very much to both of you for your help! Both methods work perfectly! Always good to know that there is more than one way to skin a cat when it comes to R! I will just need to get a grip on the regular expressions, it would seem.