Computes statistics over DataMatrix margins.

# S4 method for DataMatrix
rowMeans(x, na.rm = FALSE)

# S4 method for DataMatrix
colMeans(x, na.rm = FALSE)

# S4 method for DataMatrix
rowSums(x, na.rm = FALSE)

# S4 method for DataMatrix
colSums(x, na.rm = FALSE)

Arguments

x

A DataMatrix object.

na.rm

A logical scalar: should missing values (including NaN) be omitted from the calculations?

Details

rowMeans and colMeans

Form row and column means.

rowSums and colSums

Form row and column sums.

Author

N. Frerebeau

Examples

## Create count data matrix A <- CountMatrix(data = sample(0:10, 100, TRUE), nrow = 20, ncol = 5) ## Row and column means rowMeans(A)
#> row1 row2 row3 row4 row5 row6 row7 row8 row9 row10 row11 row12 row13 #> 4.6 5.2 3.4 2.2 3.0 1.6 4.6 6.4 3.8 7.2 4.0 3.2 5.6 #> row14 row15 row16 row17 row18 row19 row20 #> 3.6 5.4 2.0 5.4 4.6 5.2 2.2
#> col1 col2 col3 col4 col5 #> 5.25 4.05 4.25 3.55 3.70
## Row and column sums rowSums(A)
#> row1 row2 row3 row4 row5 row6 row7 row8 row9 row10 row11 row12 row13 #> 23 26 17 11 15 8 23 32 19 36 20 16 28 #> row14 row15 row16 row17 row18 row19 row20 #> 18 27 10 27 23 26 11
#> col1 col2 col3 col4 col5 #> 105 81 85 71 74