Column and row-wise sums of a matrix | R Documentation |

Column and row-wise sums of a matrix.

```
colsums(x,indices = NULL, parallel = FALSE, na.rm = FALSE, cores = 0)
rowsums(x,indices = NULL, parallel = FALSE, na.rm = FALSE, cores = 0)
```

`x` |
A numerical matrix with data. |

`indices` |
An integer vector with the indices to sum the columns/rows. |

`parallel` |
Do you want to do it in parallel in C++? TRUE or FALSE. Doens't work with argument "indices". |

`na.rm` |
A logical value indicating to remove NAs. The algorithm run in parallel so do not use with option parallel. |

`cores` |
Number of cores to use for parallelism. Valid only when argument parallel is set to TRUE. Default value is 0 and it means the maximum supported cores. |

A vector with sums.

Manos Papadakis

R implementation and documentation: Manos Papadakis <papadakm95@gmail.com>.

```
colMedians, colmeans, colVars
```

```
x <- matrix(rpois(500 * 100, 10),ncol = 100)
x1 <- colsums(x)
x2 <- colSums(x)
all.equal(x1,x2)
x1 <- rowsums(x)
x2 <- rowSums(x)
all.equal(x1,x2)
x<-x1<-x2<-NULL
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.