mp_ylee
mp_ylee

Reputation: 41

Find all values in column B associated with values in column A in R data frame

I have a data frame in R that looks like this:

bin   Family    Genus 
 1     blue     flower     
 1     green    moss   
 1     blue     tree  
 2     red      bird   
 2     red      lizard  

It is possible to have the same bin multiple times, and the associated families/genera may not be unique to one bin. I am looking to identify all families associated with each bin, and how many times each family is associated with each bin. I will repeat the test for genus.
I am ultimately trying to identify if there is variation in the names associated with each bin so I can then choose the most common name for each bin and assign that bin just one name. My data frame is quite large with thousands of bins.

Upvotes: 0

Views: 34

Answers (0)

Related Questions