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("
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
2 matches
Mail list logo