I have the following data:
ID<-c(001,002,003,003,004,005)
Email<-c("[email protected]","[email protected]","[email protected]","[email protected]","[email protected]","[email protected]")
df<-as.data.frame(cbind(ID,Email))
I want to create a table where the ID numbers for each person's email address will be shown in table format.
Email IDs
[email protected] 002
[email protected] 003
[email protected] 005
[email protected] 001, 004
I've tried an apply function, tapply(df$ID,df$Email, FUN=length
, but am only getting non-unique count.
[email protected] 1
[email protected] 2
[email protected] 1
[email protected] 2