gmExpr {gmDatabase} | R Documentation |
Creating gmExpressions
Description
gmExpr
creates a gmExpression
Usage
gmExpr(expr,...,envir=parent.frame(),EXPR=substitute(expr))
Arguments
expr |
an R-like representation of an SQL query. |
envir |
defines the environment used for evaluation of |
EXPR |
The quoted version of such an expression. |
... |
further arguments for later use in other methods. |
Details
gmExpr
creates an object of class gmExpr
, which can be used as argument in gmRead
instead of a string. Furthermore it can be extended like any other expression used in gmRead
.
For use in the geometallurgical database you need to begin every expression with root
, since data storage starts from this common root object.
The composition of an expression is done in the following way: for accessing a certain object in a class, use the $
-operator, to access its elements use square brackets []
. By specifying columnName=operation
the user can control the content of a column in the the output. Named columns are always shown in the result. If they need to be dropped set them to operation drop
. If you want to group objects by a named column, set its operation to group
. This grouping can only be done for elements at least one step down in the hierarchy.
Value
An object of class gmExpr
, containing the expression in $EXPR
and the envir
as attribute.
Author(s)
K. Gerald van den Boogaart, S. Matos Camacho
See Also
Examples
expr <- gmExpr(root$project)
## Not run:
gmConnectServer(MySQL(), ...)
gmRead(expr$series)
gmRead(expr$series[name=gmTitle, name=drop])
## naming the element gmTitle as name and dropping it in the result
gmRead(expr[pID=id]$series[name=gmTitle, pID=group])
## grouping the series by their corresponding project in the result
## End(Not run)