Learn R Programming

matlab (version 1.0.4.1)

sum: MATLAB sum function

Description

Provides sum of elements.

Usage

sum(x, na.rm=FALSE)

Value

Return value depends on argument x. If vector, returns the same as

sum. If matrix, returns vector containing the sum of each column.

Arguments

x

numeric or logical to be summed

na.rm

logical scalar. If TRUE, remove missing values

Author

P. Roebuck proebuck1701@gmail.com

Details

This is an S4 generic function.

Examples

Run this code
sum(1:9)
sum(matrix(1:9, 3, 3))

Run the code above in your browser using DataLab