Learn R Programming

scidb (version 1.2-0)

index_lookup: index_lookup

Description

The index_lookup function is a wrapper to the SciDB `index_lookup` operator. It produces a new SciDB dimension array that joins the unqiue indices defined in the array I with values looked up in array X for attribute attr. Use the index_lookup with the unique and sort functions.

Usage

index_lookup(X, I, attr, new_attr, eval=FALSE)

Arguments

X
A scidb or scidbdf object
I
A scidb or scidbdf object
attr
A character string attribute name from the X array
new_attr
An optional character name for the new attribute, defaults to attr + "_index"
eval
(Optional) If true, execute the query and store the reult array. Otherwise defer evaluation.

Value

A scidb or scidbdf object.

See Also

scidb

Examples

Run this code
## Not run: 
# data("iris")
# x <- as.scidb(iris)
# 
# # Create a unique list of elements of the "Species" attribute.
# # Note that we choose to defer evaluation of this expression.
# y <- unique(sort(project(x,"Species")), eval=FALSE)
# 
# # Append a new attribute to the array x called "Species_index" that
# # enumerates the unique values of the "Species" attribute:
# z <- index_lookup(x, y, "Species", eval=FALSE)
# 
# print(head(z))
# ## End(Not run)

Run the code above in your browser using DataLab