Learn R Programming

wccsom (version 1.2.11)

bucket: Variable averaging (bucketing) for data matrices

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

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.

Examples

Run this code
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)

Run the code above in your browser using DataLab