Description Usage Arguments Value Author(s) See Also Examples
cbind2 or cbind combine two or multiple db.obj objects to form a new db.obj. And as.list does the opposite and expand a db.obj object into a list of db.obj objects with each one of them representing one column of the original db.obj object. as.list is usually used together with Reduce and Map.
| 1 2 3 4 5 | 
| x, y | The signature of the method. Both arguments are  | 
| array | logical, default is  | 
| ... | In  | 
cbind2 or cbind: A db.Rquery object, which contains all columns of
x and y.
as.list: A list of db.Rquery objects, which are the columns of x
Author: Predictive Analytics Team at Pivotal Inc.
Maintainer: Frank McQuillan, Pivotal Inc. fmcquillan@pivotal.io
db.array combines columns of a table/view into an
array.
array.len measures the length of the array in an array column.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | ## Not run: 
## set up the database connection
## Assume that .port is port number and .dbname is the database name
cid <- db.connect(port = .port, dbname = .dbname, verbose = FALSE)
## create a table from the example data.frame "abalone"
delete('abalone', conn.id = cid)
x <- as.db.data.frame(abalone, 'abalone', conn.id = cid, verbose = FALSE)
fit <- madlib.lm(rings ~ . - id - sex, data = x)
## create a db.Rquery object that has two columns
z <- cbind(x$rings, predict(fit, x))
## plot prediction v.s. real value
plot(lookat(z, 100))
## expand the db.obj
unlist(Map(function(x)
               if (col.types(x) == "text")
                   paste(lk(unique(x)), collapse="-", sep="")
               else
                   lk(mean(x))),
           as.list(x))
## sum of all columns (excluding the 2nd column)
Reduce(function(left, right) left + right, as.list(x[-2]))
db.disconnect(cid, verbose = FALSE)
## End(Not run)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.