I have the following data:
ID<-c(001,002,003,003,004,005)
Email<-c("tom@abc.com","jane@abc.com","jim@abc.com","jim@abc.com","tom@abc.com","mike@abc.com")
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
jane@abc.com 002
jim@abc.com 003
mike@abc.com 005
tom@abc.com 001, 004
I've tried an apply function, tapply(df$ID,df$Email, FUN=length
, but am only getting non-unique count.
jane@abc.com 1
jim@abc.com 2
mike@abc.com 1
tom@abc.com 2