redimension
function is a wrapper to the SciDB `redimension` operator.redimension(x, schema, dim, FUN, `eval`=FALSE)
s
and dim
arguments must be specified.redimension
collapses multiple values.scidb
object.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.
scidb
# 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