What should the result be for Data1 <- data.frame(Vendor=c("V1","V2","V3","V4"), Account=c("A1","A2","A2","A2")) ?
Must each vendor have only one account? If not, what should the result be for Data2 <- data.frame(Vendor=c("V1","V2","V3","V1","V4","V2"), Account=c("A1","A2","A2","A2","A3","A4")) ? -Bill On Tue, Nov 17, 2020 at 1:20 PM Tom Woolman <twool...@ontargettek.com> wrote: > 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: > > set.seed(1) > > Data <- data.frame(Vendor_ID = sample(1:10000), Bank_Account_ID = > sample(1:10000)) > > > > > Thanks in advance for any help. > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.