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)

Example output

Loading required package: class
Loading required package: MASS
Loading required package: kohonen

Attaching package: 'kohonen'

The following object is masked from 'package:class':

    somgrid


Attaching package: 'wccsom'

The following object is masked from 'package:kohonen':

    unit.distances

0%....20%....40%....60%....80%....
   user  system elapsed 
  0.128   0.000   0.129 
0%....20%....40%....60%....80%....
   user  system elapsed 
  2.148   0.007   2.172 

wccsom documentation built on May 30, 2017, 12:52 a.m.

Related to bucket in wccsom...