reduce: Combine Columns

Description Usage Arguments Details Value See Also Examples

Description

Combine columns in a matrix-like object to create a new data set using the first non-zero value.

Usage

1
2
3
reduce (object, ...)
## Default S3 method:
reduce(object, columns, ...)

Arguments

object

object that may be coerced to a matrix

columns

list in which each component is a vector of subscripts for columns to be pooled

...

other arguments (not used currently)

Details

The first element of columns defines the columns of object for the first new column, the second for the second new column etc. This is a generic method. More useful methods exist for capthist and traps objects.

Value

A matrix with number of columns equal to length(columns).

See Also

capthist, reduce.capthist, reduce.traps

Examples

1
2
3
4
5
6
## matrix with random zeros
temp <- matrix(runif(20), nc = 4)
temp[sample(20,10)] <- 0
temp

reduce(temp, list(1:2, 3:4))


Search within the secr package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.