Type Cast functions | R Documentation |
db.obj
objects to other typesCoerce db.obj
object columns into other types. col.types
displays the types of each column. as.Date
converts to date (no time of day); as.time
converts to time of day (no date); as.timestamp
converts to both date and time; as.interval
converts to time interval. db.date.style
can display or set the date style for a particular connection.
## S4 method for signature 'db.obj'
as.integer(x, ...)
## S4 method for signature 'db.obj'
as.character(x, array = TRUE, ...)
## S4 method for signature 'db.obj'
as.double(x, ...)
## S4 method for signature 'db.obj'
as.logical(x, ...)
## S4 method for signature 'db.obj'
as.numeric(x, ...)
## S4 method for signature 'db.obj'
as.Date(x, ...)
db.date.style(conn.id = 1, set = NULL)
as.time(x, ...)
as.timestamp(x, ...)
as.interval(x, ...)
col.types(x)
x |
A |
array |
A logical, default is |
... |
further arguments passed to or from other methods This is currently not implemented. |
conn.id |
An integer, default is 1. The connection ID for the database connection. |
set |
A string, default is |
A db.Rquery
object, which is a SQL query which combine all columns into an array.
col.types
returns a vector of characters, which are the column types of x
.
Author: Predictive Analytics Team at Pivotal Inc.
Maintainer: Frank McQuillan, Pivotal Inc. fmcquillan@pivotal.io
by,db.obj-method
is usually used together with
aggregate functions.
## 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)
z <- as.integer(x > 1)
lookat(z, 10)
z <- as.integer(x[,2] == "M")
lookat(z, 10)
col.types(x)
col.types(z)
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.