[R] counting duplicate items that occur in multiple groups

Tom Woolman twoo|m@n @end|ng |rom ont@rgettek@com
Tue Nov 17 22:10:26 CET 2020

Hi everyone.  I have a dataframe that is a collection of Vendor IDs  
plus a bank account number for each vendor. I'm trying to find a way  
to count the number of duplicate bank accounts that occur in more than  
one unique Vendor_ID, and then assign the count value for each row in  
the dataframe in a new variable.

I can do a count of bank accounts that occur within the same vendor  
using dplyr and group_by and count, but I can't figure out a way to  
count duplicates among multiple Vendor_IDs.

Dataframe example code:

#Create a sample data frame:


Data <- data.frame(Vendor_ID = sample(1:10000), Bank_Account_ID =  

Thanks in advance for any help.

More information about the R-help mailing list