Learn R Programming

scidb (version 1.1-2)

redimension: redimension

Description

The redimension function is a wrapper to the SciDB `redimension` operator.

Usage

redimension(x, schema, dim, FUN, `eval`=FALSE)

Arguments

x
A SciDB array object of class scidb or scidbdf.
schema
An optional SciDB array object of class scidb, scidbdf, or a character string representation of the output array schema.
dim
An optional character vector or list of new dimension names from the union of dimension and attribute names of x. Exactly one of the s and dim arguments must be specified.
FUN
An optional reduction function applied when redimension collapses multiple values.
eval
(Optional) If true, execute the query and store the reult array. Otherwise defer evaluation.

Value

  • A scidb object.

Details

Redimension is a core SciDB operation. It can change the dimensionality, shape, and partitioning of arrays, and transform array attributes into array dimensions and vice versa. Redimension can also apply reduction functions to values when dimensions are removed, similarly to grouped aggregates.

The R package redimension function presents several forms. The most direct form takes a SciDB array reference x and an desired output schema s and directly applies the SciDB redimension operator.

Alternatively, users may specify a character vector or list of dim values that represent new array coordinate axes. These values should be a subset of the union of attributes and dimension names in the input array x. Note that they must also be valid int64 types.

When redimension reduces the dimensionality of an array, it's likely that multiple values may fall into the same output array cell. When this occurs, SciDB's default behavior randomly selects one of the possible values for output. Alternatively, users may specify a reduction function in the FUN argument or explicitly specify reductions using SciDB syntax in the schema argument. Note that the indicated reduction function will be applied to all the attributes. If you need more control over the reduction, explicitly specify the output schema instead.

See Also

scidb

Examples

Run this code
# Upload iris to SciDB:
x <- as.scidb(iris)

# bind an example new 'class' column:
y <- bind(x, "class", "iif(Petal_Width>2, int64(1), 0)")
z <- redimension(y, dim="class", FUN=max)

Run the code above in your browser using DataLab