sumsq {multiway}R Documentation

Sum-of-Squares of Given Object

Description

Calculates the sum-of-squares of X.

Usage

sumsq(X, na.rm = FALSE)

Arguments

X

Numeric scalar, vector, list, matrix, or array.

na.rm

logical. Should missing values (including NaN) be removed?

Value

Sum-of-squares of X.

Author(s)

Nathaniel E. Helwig <helwig@umn.edu>

Examples

##########   EXAMPLE 1   ##########
X <- 10
sumsq(X)


##########   EXAMPLE 2   ##########
X <- 1:10
sumsq(X)


##########   EXAMPLE 3   ##########
X <- matrix(1:10,5,2)
sumsq(X)


##########   EXAMPLE 4   ##########
X <- array(matrix(1:10,5,2),dim=c(5,2,2))
sumsq(X)


##########   EXAMPLE 5   ##########
X <- vector("list",5)
for(k in 1:5){ X[[k]] <- matrix(1:10,5,2) }
sumsq(X)


[Package multiway version 1.0-6 Index]