## Not run:
# # 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)")
#
# # Data counts along a dimension:
# z <- redimension(y, dim="class", FUN=count)
# # Example output:
# ## z[]
# ## 0 1
# ## 127 23
#
# # Contingency table along two dimensions:
# z <- redimension(y, dim=c("class", "Species"), FUN=count)
# # Example output:
# ## z[]
# ## 2 x 3 sparse Matrix of class "dgCMatrix"
# ## setosa versicolor virginica
# ## 0 50 50 27
# ## 1 . . 23
#
# # More aggregation examples
# set.seed(1)
# A <- bind(as.scidb(matrix(rnorm(25),5)), "m", 2)
# redimension(A, dim="i",
# FUN="avg(m) as mavg, count(val) as count, min(val) as minval, sum(m) as msum")[]
# # Example output:
# ## mavg count minval msum
# ## 0 2 5 -0.82046838 10
# ## 1 2 5 -0.01619026 10
# ## 2 2 5 -0.83562861 10
# ## 3 2 5 -2.21469989 10
# ## 4 2 5 -0.30538839 10
#
# ## End(Not run)
Run the code above in your browser using DataLab