Row_actions | R Documentation |
This function returns a db.Rquery
object, which produces the sum or mean value of all columns of one row when executed in database.
## S4 method for signature 'db.obj'
rowSums(x, na.rm = FALSE, dims = 1, ...)
## S4 method for signature 'db.obj'
rowMeans(x, na.rm = FALSE, dims = 1, ...)
x |
A |
na.rm |
logical. Should missing values (including 'NaN') be omitted from the calculations? Not implemented yet. |
dims |
integer: Which dimensions are regarded as 'rows' or 'columns' to sum over. For 'row*', the sum or mean is over dimensions 'dims+1, ...'; for 'col*' it is over dimensions '1:dims'. Not implemented yet. |
... |
Other arguments. Not implemented yet. |
A db.Rquery
object which, when executed, computes the mean or sum of all columns on every row of a table.
Author: Hong Ooi, Pivotal Inc.
Maintainer: Frank McQuillan, Pivotal Inc. fmcquillan@pivotal.io
sum,db.obj-method
, colSums,db.obj-method
compute the sum of each column.
mean,db.obj-method
, colMeans,db.obj-method
compute the mean values column-wise.
## 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)
x <- as.db.data.frame(abalone, conn.id = cid, verbose = FALSE)
lk(x, 10)
row.sum <- rowSums(x[,-2]) # the second column is text
row.avg <- rowMeans(x[,-2])
## lokk at 10 results
lk(row.sum, 10)
lk(row.avg, 10)
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.