search for: sumrows

Displaying 3 results from an estimated 3 matches for "sumrows".

Did you mean: sumrow
2011 Nov 21
4
Discarding a matrix based on the rowSums value
Hello I would appreciate your help on the followig. I want to generate random binary matrices but I need to discard those with all-1 rows. That is, for a 10x10 matrix with five 1's [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 0 0 0 0 0 0 0 0 0 1 [2,] 0 0 0 0 0 0 1 0 0 0 [3,] 0 0 0 0 0 0 1
2012 Dec 17
2
Why does matrix selection behave differently when using which?
...greater than the number of rows in "t". The table "t" I use can be downloaded from here: https://github.com/groupschoof/PhyloFun/archive/test_selector.zip Unzip the file and read in the table "t" using t <- read.table("test.tbl") The above function "sumRows" is defined as follows: sumRows <- function( tbl, ps ) { sum( sapply(ps, function(x) { t <- if ( is.na(x) ) { tbl[ which( is.na(tbl[ , "Domain.Architecture.Distance" ]) ), , drop=F] } else { tbl[ which( tbl[ , "Domain.Archite...
2010 Oct 20
2
rowsum
Hello, I am trying to achieve something which I *think* is possible using rowsum, but a little help should be useful: Consider the following dataframe DF0: A B C 89 1 140 89 06 20 89 29 137 89 52 13 89 57 10 89 97 23 89 1 37 89 1 12 89 1 3 52 1 11 52 1 31 52 1 16 52 1 6 52 1 10 52 1 13 52 1 10 52 1 25 52 1 2 52 59 38 52 97 75 57 1 14 57 1 13 57 1 14 57 114 12 57 1 23 57 06 26 I need create a