If I understand your question, this may work for you:

dat <- matrix(as.logical(sample(T:F, 30, T)),5,6)
colnames(dat) <- letters[1:6]
rownames(dat) <- paste(letters[1:5],1:5, sep="")

dat1 <- matrix(NA,5,6)
colnames(dat1) <- colnames(dat)
rownames(dat1) <- rownames(dat)
dat1[dat] <- unlist(sapply(apply(dat,2,sum),seq))

-- 
View this message in context: 
http://n4.nabble.com/Filling-a-logical-matrices-with-values-tp1469365p1470763.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
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.

Reply via email to