gmRead {gmDatabase} | R Documentation |
Return the result of an SQl query given as R-like representation
Description
gmRead
translates the R representation expr
of an SQL query into SQL and evaluates it in the database db
.
Usage
gmRead(expr,envir=parent.frame(),EXPR=substitute(expr),limit=-1,db=getOption("gmDB"))
gmReadInternal(EXPR,sel=NULL,db,gmNameVarID=getGmNameVarID(db))
Arguments
expr |
R expression of an SQL query. Expressions created with |
envir |
defines the environment used for evaluation of |
EXPR |
The quoted version of such an expression. |
sel |
The selection statement in R representation. |
limit |
defines the number of lines returned in the query. |
db |
defines the database, on which the query will be run. |
gmNameVarID |
The gmVarID in the gmDatabase of gmName for later referencing of an object by its name in the gmDatabase. |
Details
gmRead
is the principal function of the gmDatabase package. It provides the main functionality: Receiving an R expression expr
of an SQL query, it returns a dataframe, containing the requested data. On the other hand, gmReadInternal
, indicated by its notation, is meant for in-package use only. During the execution of gmRead
it creates a call containing the R representation, which is used later in gmSQL
to create and run a proper SQL query against the database.
Value
For gmRead
a dataframe is returned. It contains the requested data.
For gmReadInternal
a call is returned, consisting of an expression to be interpreted as
the R representation of SQL by gmSQL
. Furthermore a list of the asked variables in
EXPR
and the columns, where to look in the database tables are returned, too.
Author(s)
K. Gerald van den Boogaart, S. Matos Camacho
See Also
Examples
## Not run:
.gmDB <- dbConnect(...)
root <- "root"
erg <- gmRead(root)
## returns the ID of root in the database
gmRead(root$project[gmTitle=group])
## groups
## End(Not run)