Thanks Dimitris, It works nicely!
Regards, Olga On Thu, 2010-08-26 at 11:55 +0200, Dimitris Rizopoulos wrote: > one way is the following: > > mylist <- list(x1 = c("A","A","A","B","C","Z","Y"), > x2 = c("D","D","E","E","F","Z","X"), > x3 = c("A","A","A","B","Y","Z")) > newlist <- c("A","B","C","D","E","F") > > > tab <- t(sapply(mylist, function (x) > table(factor(x, levels = newlist)))) > tab[tab == 0] <- NA > tab ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.