bucket: Variable averaging (bucketing) for data matrices

Description Usage Arguments Value Author(s) Examples

View source: R/expand.R

Description

Function bucket decreases the size (i.e., the number of columns) of a data matrix by averaging variables. Function debucket achieves the reverse by linear interpolation.

Usage

1
2
bucket(x, factor)
debucket(x, nout)

Arguments

x

Data matrix: each variable corresponds with a column.

factor

Bucket factor: this number of variables will be averaged.

nout

Required number of variables after debucketing.

Value

Returns a data matrix of the new dimensions.

Author(s)

Ron Wehrens

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
data(cepha)
gr <- somgrid(3,3, "hexagonal")

X <- bucket(cepha$patterns, 4)
system.time(x <- wccsom(X, grid=gr, trwidth=5,
                        rlen=500, FineTune=FALSE))
## this is much faster than the following code:
## Not run: 
set.seed(7)
system.time(x <- wccsom(cepha$patterns, grid=gr, trwidth=20,
                        rlen=500, FineTune=FALSE))

## End(Not run)

zqzneptune/wccsom documentation built on July 16, 2020, 12:49 a.m.