rowSums
rowSums is a function in the R programming language that computes the sum of each row in a matrix or array-like object. It returns a numeric vector with one element for every row, making it useful for creating row totals or per-row aggregates in data analysis. The function is part of base R and is commonly used with numeric data.
The typical usage is rowSums(x, na.rm = FALSE, dims = 1). Here, x should be an object with
Notes on data types and preparation: rowSums operates on numeric data. When used with data frames, it
Examples: For a 2x3 matrix m created by filling values 1 through 6, rowSums(m) returns c(6, 15).
See also: rowMeans, apply, colSums. Similar functionality exists in other languages, such as NumPy’s sum with