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))
Run the code above in your browser using DataLab