# NOT RUN {
## get the help for a method
## help("mean,db.obj-method")
<!-- %% @test .port Database port number -->
<!-- %% @test .dbname Database name -->
## 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)
## get the mean of a column
mean(x$diameter)
## get the sum of a column
sum(x$height)
## get the number of entries in a column
count(x$id)
## get the max value of a column
max(x$diameter)
## get the min value of a column
min(x$diameter)
## get the standard deviation of the values in column
sd(x$diameter)
## get the variance of the values in column
var(x$diameter)
## get the mean of all columns in the table
colMeans(x)
## get the sum of all columns in the table
colSums(x)
## get the array aggregate of a specific column in the table
colAgg(x$diameter)
## get the array aggregate of all columns in the table
colAgg(x)
## put everything into an array plus a constant 1 as the first element
db.array(1, x[,3:5], x[,6:7], x[,8:10])
## ----------------------------------------------------------------------
db.disconnect(cid, verbose = FALSE)
# }
Run the code above in your browser using DataLab