idaQuery, idaScalarQuery | R Documentation |
Use these functions to run any SQL query on the database and put the
results into a data.frame
.
idaQuery(..., as.is=TRUE, na.strings = "NA")
idaScalarQuery(..., as.is=TRUE)
... |
Any number of query parts which are passed to |
as.is |
Specifies whether the result columns are to be converted using RODBC type conversions (as.is=FALSE) or left unconverted (as.is=TRUE).
For more information about RODBC type conversions, see the descriptions of the functions |
na.strings |
character vector of strings to be mapped to NA when reading character data. |
All parts of the input query are concatenated with paste(..., sep="")
and the result is passed to the database.
The idaQuery
function returns a data frame that contains the
result of the specified query.
The idaScalarQuery
function returns the result of the specified query coerced
to a single scalar value.
## Not run:
#idaScalarQuery returns a single value
v <- idaScalarQuery("SELECT COUNT(*) FROM IRIS")
#idaQuery returns a data.frame
df <- idaQuery("SELECT * FROM IRIS")
#idaQuery and idaScalarQuery automatically paste all arguments into a single query
#This is convenient if you use variables
tableName <- "IRIS"
df <- idaScalarQuery("SELECT COUNT(*) FROM ",tableName)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.