How to remove duplicate categories from dataframe : I am trying to calculate the total number of companies associated with each active investor. 

'df' represents my original dataframe, in which the 'active_investors' column displays a list of active investors for each company listed. For example, one row might contain Company A, listing investors 1,2,3,4.

What I am trying to do is split the dataframe such that it displays company A as four separate rows i.e. for each investor 1, 2, 3 and 4.

So far, I have the following code:

```
#Separate names of investors for each company
df1 = df %>% separate_rows(active_investors, sep = ",")

#Total number of companies each investor has invested in 
investor = aggregate(data.frame(count = df1$company_name), list(active_investors = df1$active_investors), length)
```

The problem is that some investors are listed twice i.e. the same investor name, but are listed as two separate investors. I am unsure how to compile the frequencies (i.e. total companies the investor has invested in) such that these duplicates are removed.