Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

colsums

Column and row-wise sums of a matrix


Description

Column and row-wise sums of a matrix.

Usage

colsums(x,indices = NULL, parallel = FALSE)

rowsums(x,indices = NULL, parallel = FALSE)

Arguments

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

Value

A vector with sums.

Author(s)

Manos Papadakis

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

See Also

Examples

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

Rfast

A Collection of Efficient and Extremely Fast R Functions

v2.0.1
GPL (>= 2.0)
Authors
Manos Papadakis, Michail Tsagris, Marios Dimitriadis, Stefanos Fafalios, Ioannis Tsamardinos, Matteo Fasiolo, Giorgos Borboudakis, John Burkardt, Changliang Zou, Kleanthi Lakiotaki and Christina Chatzipantsiou.
Initial release
2020-09-13

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.