search for: allc

Displaying 1 result from an estimated 1 matches for "allc".

Did you mean: all
2010 Jul 20
1
apply: return list of matrices
...1 [2,] 0 3 Basically, I achieved what I want except that the output format is not the way it should be: ct <- function(bc) { n <- length(bc) bc <- factor(bc) table(bc[1:(n/2)], bc[(n/2+1):n]) } ct returns a 2x2 table giving the contingency counts. f <- function(p, b) { allC <- t(combn(levels(as.factor(p)), 2)) bRaw <- apply(allC, 1, function(x) cbind(b[p==x[1]], b[p==x[2]])) # bRaw would preferable be already a list of nx2 matrices, but apply coerces the result to a single matrix, # whose columns are rbind(b[p==x[1]], b[p==x[2]]), that's why "c...