Re: [R] How to count combinations

2012-10-08 Thread arun
", "PT"), class = "factor")), .Names = c("Env", "place"), row.names = 2:22, class = "data.frame") dat1[]<-sapply(dat1,as.character)  as.matrix(table(dat1$Env,dat1$place))     # Ck CK Dk IN jk NO NW PK PR PT  # 23  1  1  0  0  1  2  3  0 

Re: [R] How to count combinations

2012-10-08 Thread arun
ist1)) mat1 # [,1] [,2] [,3] #[1,]    1    1    3 #[2,]    1    2    1 #[3,]    1    1    3 #[4,]    1    2    4 #attr(,"names")  #[1] "Ck.23" "Ck.67" "CK.23" "CK.67" "Dk.55" "IN.67" "jk.23" "NO.23" &qu

Re: [R] How to count combinations

2012-10-08 Thread Rui Barradas
Hello, Your dataset seems to have a problem, the first row should the columns' names. If I'm right, nms <- levels(dat[[1]])[dat[1,1]] nms[2] <- levels(dat[[2]])[dat[1,2]] dat <- dat[-1, ] names(dat) <- nms with(dat, table(Env, place)) If I'm wrong, with(dat, table(V1, V2)) Hope this help

[R] How to count combinations

2012-10-08 Thread Nico Met
Dear all, Need a help. I would like to count combination of two columns: structure(list(V1 = structure(c(4L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L), .Label = c("23", "55", "67", "Env"), class = "factor"), V2 = structure(c(9L, 7L, 7L, 7L, 2L, 1L, 11L, 1