od_pool: Pool of a vector

Description Usage Arguments Details Value Note Author(s) See Also Examples

View source: R/od_pool.R

Description

A function pool.fun is applied to all the elements of a vector val that appear within the groups formed by identical rows of a matrix X.

Usage

1
od_pool(X, val=NULL, pool.fun="sum", echo=TRUE)

Arguments

X

the n times k matrix of real values.

val

a real vector of length n.

pool.fun

a string denoting the function to be applied to the subgroups of elements of val corresponding to the identical rows of X. Possible values are "sum", "min", "max", "mean", "median" and "0".

echo

Print the call of the function?

Details

This function is useful for plotting (and understanding) of designs of experiments with more factors than the dimension of the plot.

Value

A list with components:

call

the call of the function

X.unique

the matrix of unique rows of X

val.pooled

the vector of the length nrows(X.unique) containing the values of val pooled using pool.fun

Note

The function performs a non-trivial operation only if some of the rows of X are identical.

Author(s)

Radoslav Harman, Lenka Filova

See Also

od_plot, od_print

Examples

1
2
3
4
5
6
7
8
9
v1 <- c(1, 2, 3); v2 <- c(2, 4, 6); v3 <- c(2, 5, 3)
X <- rbind(v1, v1, v1, v1, v2, v3, v2, v3, v3)
val <- c(1, 2, 7, 9, 5, 8, 4, 3, 6)
od_pool(X, val, "sum")

# The result $val.pooled is a vector with components:
# 19 (=1+2+7+9) because the first 4 rows of X are identical
# 9 (=5+4) because the 5th and the 7th rows of X are identical
# 17 (=8+3+6) because the 6th, the 8th and the 9th rows of X are identical

OptimalDesign documentation built on March 26, 2020, 9:35 p.m.