sumsq: Sum-of-Squares of Given Object

Description Usage Arguments Value Author(s) Examples

Description

Calculates the sum-of-squares of X.

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
##########   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)

multiway documentation built on May 2, 2019, 6:47 a.m.