Learn R Programming

scidb (version 1.2-0)

subarray: Wrapper for SciDB subarray and between operators

Description

Extract a rectangular subset from a SciDB array (between=FALSE), or mask all but a rectangular subset empty (between=TRUE).

Usage

subarray(x, limits, between=FALSE, `eval`=FALSE)

Arguments

x
A scidb or scidbdf object.
limits
Either a vector of coordinate bounds in c(low1,low2,...,upper1,upper2,...) form, or a character string schema, or a SciDB array object. See details.
between
If TRUE, form a SciDB between-style query, otherwise use subarray.
eval
If TRUE, execute the query and store the reult array. Otherwise defer evaluation.

Value

A new scidb object.

Details

The limits argument can take one of three forms:

  • A vector of coordinate bounds listing the lower bounds for each dimension first followed by the upper bounds for each dimension, in order (see examples).

  • A character string schema that contains a SciDB schema with the same dimensions as x. Limits will be taken from the schema dimension bounds.
  • A scidb or scidbdf object. Limits will be taken from the object's dimension bounds.
  • Use between=FALSE for the default SciDB subarray operator. Subarray returns a new zero-indexed array containing the specified rectangular subset. Subarray may move data in SciDB to the new array zero origin.

    Use between=TRUE for the SciDB between operator. Between does not change the array bounds or origin. It simply masks cells outside of the specified rectangular region empty. Because between doesn't move data it's very fast.

    See the examples for a simple comparison of the difference.

    See Also

    scidb

    Examples

    Run this code
    ## Not run: 
    # x <- as.scidb(iris)
    # # Extract rows 3--5 (note the indices of the returned results)
    # subarray(x,c(3,5))[]
    # 
    # # Extract rows 3--5 using SciDB between (note the indices)
    # subarray(x,c(3,5), between=TRUE)[]
    # ## End(Not run)

    Run the code above in your browser using DataLab