package ‘scidb’ · scidb attributes representing each column of the data.frame. the functions...

25
Package ‘scidb’ March 27, 2013 Type Package Title An R interface to SciDB Version 1.0-1 Date 2013-03-27 Author Paradigm4, B. W. Lewis Maintainer B. W. Lewis <[email protected]> Copyright Paradigm4, Inc. Description SciDB is an open-source array database (http://scidb.org). The scidb package provides an R interface to SciDB. BugReports https://github.com/Paradigm4/SciDBR/issues Depends stats, methods, iterators License AGPL-3 LazyLoad yes NeedsCompilation yes Repository CRAN Date/Publication 2013-03-27 18:17:28 R topics documented: scidb-package ........................................ 2 as.scidb ........................................... 3 between ........................................... 4 df2scidb ........................................... 5 dim.scidb .......................................... 6 dimnames.scidb ....................................... 7 iquery ............................................ 8 1

Upload: others

Post on 14-Jul-2020

9 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Package ‘scidb’ · SciDB attributes representing each column of the data.frame. The functions as.scidband df2scidb are equivalent in this use case. The SciDB array row and column

Package ‘scidb’March 27, 2013

Type Package

Title An R interface to SciDB

Version 1.0-1

Date 2013-03-27

Author Paradigm4, B. W. Lewis

Maintainer B. W. Lewis <[email protected]>

Copyright Paradigm4, Inc.

Description SciDB is an open-source array database (http://scidb.org).The scidb package provides an R interface to SciDB.

BugReports https://github.com/Paradigm4/SciDBR/issues

Depends stats, methods, iterators

License AGPL-3

LazyLoad yes

NeedsCompilation yes

Repository CRAN

Date/Publication 2013-03-27 18:17:28

R topics documented:scidb-package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2as.scidb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3between . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4df2scidb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5dim.scidb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6dimnames.scidb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7iquery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

1

Page 2: Package ‘scidb’ · SciDB attributes representing each column of the data.frame. The functions as.scidband df2scidb are equivalent in this use case. The SciDB array row and column

2 scidb-package

is.scidb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9is.scidbdf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10length.scidb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10names.scidb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11nrow.scidb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11Ops.scidb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12print.scidb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12scidb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13scidb-class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15scidbconnect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17scidbdf-class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18scidbdisconnect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19scidblist . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19scidbmultiply . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20scidbremove . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21str.scidb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22summary.scidb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

Index 24

scidb-package SciDB interface package.

Description

The scidb package provides basic functions that move data between R and SciDB and issue SciDBqueries.

Details

Package: scidbType: PackageVersion: 0.0Date: 2012-07-18License: GPL3Depends: methods

Author(s)

B. W. Lewis <[email protected]>

Maintainer: B. W. Lewis <[email protected]>

Page 3: Package ‘scidb’ · SciDB attributes representing each column of the data.frame. The functions as.scidband df2scidb are equivalent in this use case. The SciDB array row and column

as.scidb 3

as.scidb Upload an R matrix or data.frame to a SciDB array.

Description

Cast an R matrix or data.frame to a SciDB array, returning a reference scidb object.

Usage

as.scidb(X, name = ifelse(exists(as.character(match.call()[2])), as.character(match.call()[2]), tmpnam("array")), rowChunkSize = 1000L, colChunkSize = 1000L, start = c(0L,0L), gc=FALSE, ...)

Arguments

X A matrix of double-precision floating point values or a data.frame.

name The name of the SciDB array to create, defaulting to the R variable name ifavailable.

rowChunkSize Maximum SciDB chunk size for the 1st array dimension.

colChunkSize Maximum SciDB chunk size for the 2nd array dimension (ignored for vectorsand data.frames).

start Starting dimension numeric index value or values.

gc Set to TRUE to remove SciDB array when R object is garbage collected or Rexists. FALSE means SciDB array persists.

... additional arguments to pass to df2scidb (see df2scidb).

Details

Used with a matrix or vector argument, the as.scidb function creates a single-attribute SciDBarray named name and copies the data from X into it, returning a scidb object reference to the newarray. The SciDB array will be 1-D if X is a vector, and 2-D if X is a matrix.

If X is a data.frame, then as.scidb creates a one-dimensional multi-attribute SciDB array, withSciDB attributes representing each column of the data.frame. The functions as.scidb and df2scidbare equivalent in this use case.

The SciDB array row and column chunk sizes are set to the minimum of the number of rows andcolumns of X and the specified rowChunkSize and colChunkSize arguments, respectively. Thecolumn chunk size argument is ignored if the X is a vector.

This function supports double-precision, integer (32-bit), logical, and single-character array at-tribute types.

Value

A scidb reference object.

Author(s)

B. W. Lewis <[email protected]>

Page 4: Package ‘scidb’ · SciDB attributes representing each column of the data.frame. The functions as.scidband df2scidb are equivalent in this use case. The SciDB array row and column

4 between

See Also

scidb df2scidb

Examples

## Not run:X <- matrix(runif(20),5)A <- as.scidb(X)as.scidb(iris)scidblist()print(A)

## End(Not run)

between between

Description

Use between to select contiguous subarrays in indexing operations. The between function wouldnot normally be used directly but rather inside bracket indexing operations as shown in the example.This function is designed to support efficient indexing of contiguous subarrays for arrays with non-integer dimensions.

Usage

between(a,b)

Arguments

a A SciDB array range bound (numeric or string in the case of non-integer dimen-sion)

b A SciDB array range bound (numeric or string in the case of non-integer dimen-sion)

Value

A function that evaluates to a list of the specified bounds.

Note

Between requires argument values that correspond to the array dimension types (no dimensioncasting is performed).

Author(s)

B. W. Lewis<[email protected]>

Page 5: Package ‘scidb’ · SciDB attributes representing each column of the data.frame. The functions as.scidband df2scidb are equivalent in this use case. The SciDB array row and column

df2scidb 5

See Also

scidb

Examples

## Not run:# Build a two-dimensional array called ’yikes’ with a non-integer dimensionscidbremove(c("cazart","yikes"),error=warning)iquery("store(apply(build_sparse(<val:double>[i=0:9,5,1,j=0:20,2,0],random()/1000000000,i<j or j=20),a,format(i,’aiquery("create array yikes<val:double>[a(string)=*,5,1,j=0:20,2,0]")iquery("redimension_store(cazart,yikes)")

yikes <- scidb("yikes")yikes[between(’a3’,’a8’),] []

## End(Not run)

df2scidb Copy a data frame into a SciDB array.

Description

Copy a data frame into a new 1-D SciDB array.

Usage

df2scidb(X, name = ifelse(exists(as.character(match.call()[2])), as.character(match.call()[2]), "X"), dimlabel = "row", chunkSize, rowOverlap = 0L, types = NULL, nullable = FALSE, real_format = "%.15f", gc)

Arguments

X A data frame.

name The SciDB array name, defaults to the R variable name if available.

dimlabel Name the SciDB dimension.

chunkSize The SciDB chunk size.

rowOverlap The SciDB chunk overlap.

types An optional vector explicitly specifying the SciDB attribute types. Length mustmatch the number of columns of the data frame.

nullable An optional vector indicating the SciDB nullable property of each attribute.Length must match the number of columns of the data frame.

real_format The format string used to print real values.

gc Optional logical value. If TRUE, then resulting SciDB array will be garbage-collected when the R variable referencing it is. The default value is FALSE.

Page 6: Package ‘scidb’ · SciDB attributes representing each column of the data.frame. The functions as.scidband df2scidb are equivalent in this use case. The SciDB array row and column

6 dim.scidb

Details

df2scidb is a workhorse utility function that transfers an R data frame into a 1-D SciDB array viaintermediate CSV formatting. The columns of the data frame correspond to attributes in the SciDBarray. The iquery function returns query results using a similar method as R data frames.

Value

NULL is invisibly returned. SciDB errors are propagated as R error conditions.

Author(s)

B. W. Lewis <[email protected]>

Examples

## Not run:df2scidb(iris)scidblist()head(iquery("scan(iris)", return=TRUE))

## End(Not run)

dim.scidb dim

Description

dim

Usage

## S3 method for class ’scidb’dim(x)

Arguments

x A scidb object.

Value

Vector of matrix dimensions or NULL.

Author(s)

B. W. Lewis <[email protected]>

Page 7: Package ‘scidb’ · SciDB attributes representing each column of the data.frame. The functions as.scidband df2scidb are equivalent in this use case. The SciDB array row and column

dimnames.scidb 7

dimnames.scidb dimnames

Description

Return a list of dimension names. Warning! Huge SciDB arrays may return enormous lists.

Usage

## S3 method for class ’scidb’dimnames(x)

Arguments

x SciDB array reference object.

Details

Don’t use this function for huge SciDB arrays. Instead, iterate through SciDB dimension valuesusing iquery as shown in the examples.

Value

A list of dimension names.

Author(s)

B. W. Lewis <[email protected]>

See Also

iquery

Examples

## Not run:# Build a two-dimensional array called ’yikes’ with a non-integer dimensionscidbremove(c("cazart","yikes"),error=warning)iquery("store(apply(build_sparse(<val:double>[i=0:9,5,1,j=0:20,2,0],random()/1000000000,i<j or j=20),a,format(i,’aiquery("create array yikes<val:double>[a(string)=*,5,1,j=0:20,2,0]")iquery("redimension_store(cazart,yikes)")

yikes <- scidb("yikes")

dimnames(yikes)

# Here is an alternate approach that iterates through dimension names# along one dimension for huge arrays:i <- iquery("yikes:a", return=TRUE, iterative=TRUE)

Page 8: Package ‘scidb’ · SciDB attributes representing each column of the data.frame. The functions as.scidband df2scidb are equivalent in this use case. The SciDB array row and column

8 iquery

nextElem(i)

## End(Not run)

iquery Simple SciDB query tool

Description

Issue SciDB queries and optionally return output in a data frame.

Usage

iquery(query, ‘return‘ = FALSE, afl = TRUE, iterative = FALSE, n = 1000, excludecol, ...)

Arguments

query A SciDB query string (character). Separate multiple queries with semicolons.

return Set to TRUE to return output. Otherwise don’t return query output. Only avail-able when afl=TRUE

afl TRUE indicates query is in AFL form, FALSE indicates AQL.

iterative Set to TRUE to return a result iterator. FALSE returns entire result at once.

n Maximum number of rows to return when iterating through results.

excludecol An optional numeric range of columns to exclude from iterative results (onlyapplies when iterative=TRIE).

... Options passed on to read.table used to parse results.

Details

The iquery function is a simple analog of the command-line SciDB iquery program.

Value

If return=TRUE, return the query result in data frame form (similar to the command-line -olcsv+output option).

If return=FALSE, return the query ID number.

SciDB errors encountered during query processing are propagated to R and can be handled withnormal R error handling mechanisms.

Set itreative=TRUE to return a result iterator. Use the iterator nextElem function to iterativelyreturn results, a maximum of n results at a time. See help in the iterators package for examplesand options.

Page 9: Package ‘scidb’ · SciDB attributes representing each column of the data.frame. The functions as.scidband df2scidb are equivalent in this use case. The SciDB array row and column

is.scidb 9

Author(s)

B. W. Lewis <[email protected]>

Examples

## Not run:iquery("list(’instances’)",return=TRUE)

# A simple example that iterates through results using foreach# Build an array with 1 million numbers from zero to 1.iquery("store(build(<x:double>[i=1:1000000,100000,0],i/1000000),X)")# Apply a function and return result in an iterator:i <- iquery("apply(X, y, sin(x))", return=TRUE, iterative=TRUE)

# Sum up x and y (and dimension i too)library("foreach")foreach(j=i, .combine=function(...)colSums(rbind(...)))

# Compare with the much faster equivalent inside SciDB:iquery("aggregate(apply(X, y, sin(x)),sum(x),sum(y))", return=TRUE)

## End(Not run)

is.scidb is.scidb

Description

Is this a SciDB array object?

Usage

is.scidb(x)

Arguments

x Something.

Value

Returns TRUE if x is a SciDB object.

Author(s)

B. W. Lewis<[email protected]>

Page 10: Package ‘scidb’ · SciDB attributes representing each column of the data.frame. The functions as.scidband df2scidb are equivalent in this use case. The SciDB array row and column

10 length.scidb

is.scidbdf is.scidbdf

Description

Is this a SciDB array data.frame-like object?

Usage

is.scidbdf(x)

Arguments

x Something.

Value

Returns TRUE if x is a SciDB object.

Author(s)

B. W. Lewis<[email protected]>

length.scidb length

Description

Return the total number of array elements of a SciDB array object.

Usage

## S3 method for class ’scidb’length(x)

Arguments

x A scidb object.

Value

Numeric length of the object in elements.

Author(s)

B. W. Lewis <[email protected]>

Page 11: Package ‘scidb’ · SciDB attributes representing each column of the data.frame. The functions as.scidband df2scidb are equivalent in this use case. The SciDB array row and column

names.scidb 11

names.scidb Dimension names

Description

Return 2nd dimension names of a SciDB array with two or more dimensions, or just the singledimension names of a 1-d SciDB array reference object. Warning! Huge SciDB arrays can retuntoo much. See scidb for an example alternative approach.

Usage

## S3 method for class ’scidb’names(x)

Arguments

x A SciDB array reference object.

Value

Returns a vector of dimension names.

Author(s)

B. W. Lewis <[email protected]>

nrow.scidb Number of rows or columns of a SciDB matrix.

Description

Return the number of rows of a SciDB matrix (2-D array).

Usage

## S3 method for class ’scidb’nrow(x)## S3 method for class ’scidb’ncol(x)

Arguments

x A scidb object.

Value

The number of rows of the matrix.

Page 12: Package ‘scidb’ · SciDB attributes representing each column of the data.frame. The functions as.scidband df2scidb are equivalent in this use case. The SciDB array row and column

12 print.scidb

Author(s)

B. W. Lewis <[email protected]>

Ops.scidb Binary scidb object operations.

Description

Binary scidb object operations.

Usage

## S3 method for class ’scidb’Ops(e1, e2)

Arguments

e1 A scidb matrix reference or double-precision R matrix.

e2 A scidb matrix reference or double-precision R matrix.

Value

A scidb matrix reference.

Author(s)

B. W. Lewis <[email protected]>

print.scidb Print a summary of a SciDB array object.

Description

Print a summary of a SciDB array object.

Usage

## S3 method for class ’scidb’print(x, ...)

Arguments

x A scidb array object.

... further arguments passed to or from other methods.

Page 13: Package ‘scidb’ · SciDB attributes representing each column of the data.frame. The functions as.scidband df2scidb are equivalent in this use case. The SciDB array row and column

scidb 13

Value

Printed summary output.

Author(s)

B. W. Lewis <[email protected]>

scidb Create a scidb reference object.

Description

Create an array-like R object reference to a SciDB array.

Usage

scidb(name, attribute = "", ‘data.frame‘, gc)

Arguments

name Name of the SciDB array to reference.

attribute Name of an attribute within the array.

data.frame Return a data.frame-like object (requires 1D SciDB array).

gc TRUE means SciDB array shall be removed when R object is garbage collectedor R exists. FALSE means SciDB array persists.

Details

The referenced array may be any SciDB array. One-dimensional SciDB arrays may be referencesas data.frame-like objects in which the SciDB array attributes appear as data.frame columns, or asone-column matrices.

SciDB arrays of dimension 2 or more appear as R arrays. In such cases, only one attribute may bereferenced per object. (The SciDB array may contain multiple attributes.)

If the SciDB array contains more than one attribute, use the attribute argument to specify whichattribute to use in the reference object. The first listed attribute is used by default if no attribute isspecified.

The scidb class supports sparse and dense SciDB arrays of any dimension. Attribute types real,integer (32-bit), logical, and single-character (one byte) are supported. Integer and non-integerdimensions are supported, with some limitations described below.

R does not have a native 64-bit integer type. SciDB uses 64-bit integer dimensions. The scidb pack-age uses R double-precision floating point integers to index SciDB integer dimensions, restrictingR to dimension values below 2^(53).

String-valued SciDB non-integer dimensions are also supported. Other types of SciDB non-integerdimensions are not supported yet by the scidb package.

Page 14: Package ‘scidb’ · SciDB attributes representing each column of the data.frame. The functions as.scidband df2scidb are equivalent in this use case. The SciDB array row and column

14 scidb

The scidb class generally follows SciDB indexing convention, which sometimes differs from Rindexing conventions. In particular, note that the starting SciDB integer index is arbitrary, but oftenzero. (The upper-left corner of R arrays is always indexed by [1,1,...].) SciDB integer dimensionindices will be displayed as R dimension names. Subarray indexing operations use the SciDB con-vention. Thus, zero and negative indices are literally interpreted and passed to SciDB. In particular,negative indices do not indicate index omission, unlike standard R arrays.

With the exception of the empty indexing operation, [], subarray indexing operations return newSciDB reference array objects. Use the empty indexing operation to materialize data from theSciDB backing array into a normal R array.

The scidb class omits dimension indices with all empty cells in sparse SciDB arrays when materi-alizing data as R arrays with the [] operator.

Use the between function to efficiently index rectangular contiguous subarrays.

Subsets of sparse SciDB arrays are bounded by the data extent and returned to R as dense arrayswith a default fill-in value in the empty cells. The default empty value may be specified duringindexing with the default= argument (see the examples below), and gloablly using the packageoption options(scidb.default.value=NA) (see scidb-package). See the vignette examples fora more compete discussion of sparsity.

Value

A scidb object that references the indicated SciDB array.

Author(s)

B. W. Lewis <[email protected]>

See Also

between

Examples

## Not run:scidbconnect()# A basic 1-d array, showing selection of attribute:df2scidb(iris,nullable=FALSE)A <- scidb("iris", attribute="Petal_Width")dim(A)

# A sparse 3-d array example:scidbremove(A, error=warning)iquery("store(build_sparse(<val:double>[i=0:9,10,0,j=0:9,5,0,k=0:9,2,0],k,k<99 and (j=1 or j=3 or j=5 or j=7)),A)")A <- scidb("A")

# Indexing operations return new SciDB arrays:A[,2:3,5:8]

# But, their data can be materialized into an R array with []:A[,2:3,5:8] []

Page 15: Package ‘scidb’ · SciDB attributes representing each column of the data.frame. The functions as.scidband df2scidb are equivalent in this use case. The SciDB array row and column

scidb-class 15

# A sparse 2-d array.scidbremove(c("A"), error=warning)iquery("store(build_sparse(<val:double>[i=0:9,5,0,j=0:9,5,0],i,i=j),A)")A <- scidb("A")

# The materialization process from sparse SciDB arrays to R uses a default# fill-in value globally specified in options("scidb.default.value"). Or, use# the ’default’ argument to change the default:scidbremove(c("A","B"),error=warning)iquery("store(build_sparse(<x:double>[i=0:9,5,0,j=0:9,5,0],1,i=(j-1)),A)")iquery("create array B<x:double>[a(string)=10,5,0,b(string)=10,5,0]")iquery("redimension_store(apply(A,a,’a’+string(i),b,’b’+string(j)),B)")B <- scidb("B")

B[]B[,default=0]

## End(Not run)

scidb-class Class "scidb"

Description

A class that represents SciDB arrays as R arrays.

Objects from the Class

Objects can be created by calls of the form new("scidb", ...), scidb("ARRAY_NAME", ...), oras.scidb(R_MATRIX, ...).

Slots

call: Object of class "call" How scidb was called.

name: Object of class "character" scidb array name.

D: Object of class "list" List of scidb dimension information.

dim: Object of class "numericOrNULL" Vector of dimension lengths.

length: Object of class "numeric" Length of array object.

attribute: Object of class "character" The SciDB array attribute in use by scidb array referenceobject (only one attribute may be referenced at a time).

attributes: Object of class "character" Vector of all available attributes for the SciDB array.

nullable: Object of class "logical" Is the attribute nullable (TRUE/FALSE)?

type: Object of class "character" SciDB type of the referenced attribute.

types: Object of class "character" Vector of SciDB types for all the array attributes.

Page 16: Package ‘scidb’ · SciDB attributes representing each column of the data.frame. The functions as.scidband df2scidb are equivalent in this use case. The SciDB array row and column

16 scidb-class

gc: Object of class "environment" An environment used to link the SciDB array to the R garbagecollector.

.S3Class: Object of class "character" ~~

Methods

%*% signature(x = "matrix", y = "scidb"): ...

%*% signature(x = "scidb", y = "matrix"): ...

%*% signature(x = "scidb", y = "scidb"): ...

crossprod signature(x = "matrix", y = "scidb"): ...

crossprod signature(x = "scidb", y = "matrix"): ...

crossprod signature(x = "scidb", y = "scidb"): ...

tcrossprod signature(x = "matrix", y = "scidb"): ...

tcrossprod signature(x = "scidb", y = "matrix"): ...

tcrossprod signature(x = "scidb", y = "scidb"): ...

is.scidb signature(x = "scidb"): ...

is.scidb signature(x = "ANY"): ...

print signature(x = "scidb"): ...

head signature(x = "scidb"): ...

filter signature(x = "scidb", y = "character"): ...

count signature(x = "scidb"): ...

tail signature(x = "scidb"): ...

image signature(x = "scidb"): image(x, grid=c(m,n), op="sum(attribute)")

Display a heatmap-like image of the 2-d scidb array reference object x. grid(m,n) specifiesthe repartitioned array block sizes and op is a valid SciDB aggregation function applied to therepartitioned chunks.

show signature(object = "scidb"): ...

Notes

SciDB arrays are general n-dimensional sparse arrays with integer or non-integer dimensions. Thescidb class represents SciDB arrays in a way that mimics standard R arrays in many ways.

Matrix arithmetic operations are overloaded for 2-D arrays.

Author(s)

B. W. Lewis <[email protected]>

Page 17: Package ‘scidb’ · SciDB attributes representing each column of the data.frame. The functions as.scidband df2scidb are equivalent in this use case. The SciDB array row and column

scidbconnect 17

scidbconnect Connect to a SciDB database.

Description

Connect to a SciDB database.

Usage

scidbconnect(host = "localhost", port = 8080L)

Arguments

host The host name or I.P. address of the SciDB database instance to connect to(character).

port The port number of the SciDB database simple HTTP service to connect to(integer).

Details

The SciDB connection state is maintained internally to the scidb package. We internalize state tofacilitate operations involving scidb objects.

Thus, only one open SciDB connection is supported at a time.

One may connect to and use multiple SciDB databases by sequentially calling scidbconnect be-tween operations. Note that scidb objects are not valid across different SciDB databases.

Value

NULL is invisibly returned. SciDB connection errors are propagated to R and may be handled withthe usual R error handling mechanisms.

Note

Disconnection is automatically handled by the package.

Author(s)

B. W. Lewis <[email protected]>

Page 18: Package ‘scidb’ · SciDB attributes representing each column of the data.frame. The functions as.scidband df2scidb are equivalent in this use case. The SciDB array row and column

18 scidbdf-class

scidbdf-class Class "scidbdf"

Description

A class that represents 1D SciDB arrays similarly to R data.frames.

Objects from the Class

Objects can be created by calls of the form new("scidbdf", ...), scidb("ARRAY_NAME", ...),or as.scidb(R_DATA_FRAME, ...).

Slots

call: Object of class "call" How scidb was called.

name: Object of class "character" scidb array name.

D: Object of class "list" List of scidb dimension information.

dim: Object of class "numericOrNULL" Vector of dimension lengths.

length: Object of class "numeric" Length of array object.

attributes: Object of class "character" Vector of all available attributes for the SciDB array.

nullable: Object of class "logical" Is the attribute nullable (TRUE/FALSE)?

types: Object of class "character" Vector of SciDB types for all the array attributes.

colClasses: Object of class "character" Optional vector of read.table-style column classes usedto parse messages from SciDB.

gc: Object of class "environment" An environment used to link the SciDB array to the R garbagecollector.

.S3Class: Object of class "character" ~~

Methods

is.scidbdf signature(x = "scidbdf"): ...

is.scidbdf signature(x = "ANY"): ...

print signature(x = "scidbdf"): ...

head signature(x = "scidbdf"): ...

tail signature(x = "scidbdf"): ...

aggregate signature(x = "scidbdf"): aggregate(x, formula, FUN)

Group the 1D SciDB array x by the indicated formula, applying the SciDB aggregate expres-sion FUN, specified as a character string, to the groups. The SciDB aggregate expression mustbe named using the SciDB "as" keyword. This function will redimension the SciDB array andapply the aggregate. For example: A = as.scidb("iris"); g = aggregate(A, Petal_Length ~ Species, "avg(Petal_Length) as mean")

show signature(object = "scidbdf"): ...

Page 19: Package ‘scidb’ · SciDB attributes representing each column of the data.frame. The functions as.scidband df2scidb are equivalent in this use case. The SciDB array row and column

scidbdisconnect 19

Notes

Like the related scidb class, the scidbdf class represents SciDB arrays as R objects. The scidbdfclass presents 1-D SciDB arrays, potentially with many SciDB attributes (variables), as a data.frame-like object.

Author(s)

B. W. Lewis <[email protected]>

scidbdisconnect Disconnect from a SciDB database.

Description

SciDB connections are automatically disconnected by the package in normal practice. The scidbdisconnectfunction forces the current connection to disconnect.

Usage

scidbdisconnect()

Value

NULL is invisibly returned.

Author(s)

B. W. Lewis <[email protected]>

scidblist List SciDB database items.

Description

List arrays and various other items available in a SciDB database.

Usage

scidblist(pattern, type = c("arrays", "operators", "functions", "types", "aggregates", "instances","queries"), verbose = FALSE)

Arguments

pattern Filter the list by a regular-expression style pattern.

type A character string indicating the type of SciDB item to list–defaults to ’array.’

verbose Include extra available information for some items (arrays, in particular).

Page 20: Package ‘scidb’ · SciDB attributes representing each column of the data.frame. The functions as.scidband df2scidb are equivalent in this use case. The SciDB array row and column

20 scidbmultiply

Value

A data frame of listed items.

Author(s)

B. W. Lewis <[email protected]>

Examples

## Not run:# List information about the SciDB cluster we’re connected to:scidblist(’instances’)

# List all arrays:scidblist()

# List all arrays beginning with "A:"scidblist(pattern="^A")

## End(Not run)

scidbmultiply XXX ~~function to do ... ~~

Description

XXX ~~ A concise (1-5 lines) description of what the function does. ~~

Usage

scidbmultiply(e1, e2)

Arguments

e1 XXX ~~Describe e1 here~~e2 XXX ~~Describe e2 here~~

Details

XXX ~~ If necessary, more details than the description above ~~

Value

XXX ~Describe the value returned XXX If it is a LIST, use XXX

comp1 Description of ’comp1’

XXX

comp2 Description of ’comp2’

XXX ...

Page 21: Package ‘scidb’ · SciDB attributes representing each column of the data.frame. The functions as.scidband df2scidb are equivalent in this use case. The SciDB array row and column

scidbremove 21

Note

XXX ~~further notes~~

Author(s)

XXX ~~who you are~~

References

XXX ~put references to the literature/web site here ~

See Also

XXX ~~objects to See Also as help, ~~~

Examples

##---- Should be DIRECTLY executable !! ----##-- ==> Define data, use random,##--or do help(data=index) for the standard data sets.

## The function is currently defined asfunction (e1, e2){

x = basename(tempfile(pattern = "array"))scidbquery(paste("store(multiply(", e1@name, ",", e2@name,

"),", x, ")", sep = ""))return(scidb(x))

}

scidbremove Remove an array.

Description

Remove (delete) an array from SciDB.

Usage

scidbremove(x, error = stop)

Arguments

x The name of the SciDB array to remove (character). This may also be a vectorof names to remove.

error Error handling function.

Page 22: Package ‘scidb’ · SciDB attributes representing each column of the data.frame. The functions as.scidband df2scidb are equivalent in this use case. The SciDB array row and column

22 str.scidb

Value

NULL is invisibly returned. SciDB errors are returned as normal R errors and may be handledaccordingly.

Note

Supply a user-defined error handling function to avoid stopping on error (for example trying todelete a non-existing array). For example, use error=warning to covert errors to warnings but stillreport them.

Author(s)

B. W. Lewis<[email protected]>

Examples

## Not run:df2scidb(cars)df2cidb(iris)scidbremove(c("iris","cars","undefined"), error=warning)

# Remove everything (caution!)scidbremove(scidblist())

## End(Not run)

str.scidb Show the structure of a scidb object.

Description

Print a summary of the dimension structure of a scidb array object.

Usage

## S3 method for class ’scidb’str(object, ...)

Arguments

object a scidb array object.

... additional objects for str (see str).

Value

str does not return anything, for efficiency reasons. The obvious side effect is output to the termi-nal.

Page 23: Package ‘scidb’ · SciDB attributes representing each column of the data.frame. The functions as.scidband df2scidb are equivalent in this use case. The SciDB array row and column

summary.scidb 23

Author(s)

B. W. Lewis <[email protected]>

summary.scidb Summarize scidb object class.

Description

Summarize scidb object class. This is not a really useful function.

Usage

## S3 method for class ’scidb’summary(x)

Arguments

x a scidb arry object.

Author(s)

B. W. Lewis <[email protected]>

Page 24: Package ‘scidb’ · SciDB attributes representing each column of the data.frame. The functions as.scidband df2scidb are equivalent in this use case. The SciDB array row and column

Index

∗Topic \textasciitildekwd1scidbmultiply, 20

∗Topic \textasciitildekwd2scidbmultiply, 20

∗Topic classesscidb-class, 15scidbdf-class, 18

∗Topic packagescidb-package, 2

%*%,matrix,scidb-method (scidb-class),15

%*%,scidb,matrix-method (scidb-class),15

%*%,scidb,scidb-method (scidb-class), 15

aggregate,scidbdf-method(scidbdf-class), 18

as.scidb, 3

between, 4, 14

count (scidb-class), 15count,scidb-method (scidb-class), 15crossprod,matrix,scidb-method

(scidb-class), 15crossprod,scidb,matrix-method

(scidb-class), 15crossprod,scidb,scidb-method

(scidb-class), 15

df2scidb, 3, 4, 5dim.scidb, 6dimnames.scidb, 7

filter (scidb-class), 15filter,scidb,character-method

(scidb-class), 15

head,scidb-method (scidb-class), 15head,scidbdf-method (scidbdf-class), 18help, 21

image (scidb-class), 15image,scidb-method (scidb-class), 15iquery, 7, 8is.scidb, 9is.scidb,ANY-method (scidb-class), 15is.scidb,scidb-method (scidb-class), 15is.scidbdf, 10is.scidbdf,ANY-method (scidbdf-class),

18is.scidbdf,scidbdf-method

(scidbdf-class), 18

length.scidb, 10

names.scidb, 11ncol.scidb (nrow.scidb), 11nrow.scidb, 11

Ops.scidb, 12

print,scidb-method (scidb-class), 15print,scidbdf-method (scidbdf-class), 18print.scidb, 12

scidb, 4, 5, 11, 13scidb-class, 15scidb-package, 2scidbconnect, 17scidbdf-class, 18scidbdisconnect, 19scidblist, 19scidbls (scidblist), 19scidbmultiply, 20scidbremove, 21scidbrm (scidbremove), 21show,scidb-method (scidb-class), 15show,scidbdf-method (scidbdf-class), 18str, 22str.scidb, 22summary.scidb, 23

24

Page 25: Package ‘scidb’ · SciDB attributes representing each column of the data.frame. The functions as.scidband df2scidb are equivalent in this use case. The SciDB array row and column

INDEX 25

tail,scidb-method (scidb-class), 15tail,scidbdf-method (scidbdf-class), 18tcrossprod,matrix,scidb-method

(scidb-class), 15tcrossprod,scidb,matrix-method

(scidb-class), 15tcrossprod,scidb,scidb-method

(scidb-class), 15