[R] crosstabulation and unlist function
eugen pircalabelu
eugen_pircalabelu at yahoo.com
Mon Oct 12 20:36:58 CEST 2009
Hello R-users,
My toy example:
aa<-c(1:5)
bb<-c(NA,2,NA,4,5)
cc<-c(1,2,NA,4,NA)
dd<-c("A","B","B","A","C")
df<-data.frame(aa,bb,cc,dd=as.factor(dd))
table(unlist(df[,1:3]))
Can anyone point me to what function let's me do a crosstabulation between table(unlist(df[,1:3])) and df$dd?
I want to find out when dd==A (or B, or C) how many times do the values 1, 2 ,3,.. appear in df[,1:3]?
Thank you very much!
Eugen Pircalabelu
More information about the R-help
mailing list