Assuming a dataframe as set out below:
A<-c("John","John","James","Brad")
B<-c("Deb","Deb","Henry","Suzie")
C<-c("Barry","Beth","Deb","Louise")
D<-c("Ben","Dory","John","Simon")
df<-data.frame(A,B,C,D)
df
A B C D
1 John Deb Barry Ben
2 John Deb Beth Dory
3 James Henry Deb John
4 Brad Suzie Louise Simon
How does one go about generating a frequency table showing the total number of times the combination of values in column A & B are found in the same row. The output for this would look like the following.
A B n
1 Brad Suzie 1
2 James Henry 1
3 John Deb 3
I'm aware of simple frequency tables using dplyr
but I'm unable to get it to work in this scenario.