| makeFilter | R Documentation |
This function takes inputs of column name, filter value and filter operator and
returns an array of filters to be used in labkey.selectRows and getRows.
makeFilter(..., asList=FALSE)
... |
Arguments in c("colname","operator","value") form, used to create a filter. |
asList |
Boolean flag when set to TRUE will format the return value as a list with named elements. |
These filters are applied to the data prior to import into R. The user can specify as many filters as desired. The format for specifying a filter is a vector of characters including the column name, operator and value.
a string specifying the name of the column to be filtered
a string specifying what operator should be used in the filter (see options below)
an integer or string specifying the value the columns should be filtered on
Operator values:
EQUAL
DATE_EQUAL
NOT_EQUAL
DATE_NOT_EQUAL
NOT_EQUAL_OR_MISSING
GREATER_THAN
DATE_GREATER_THAN
LESS_THAN
DATE_LESS_THAN
GREATER_THAN_OR_EQUAL
DATE_GREATER_THAN_OR_EQUAL
LESS_THAN_OR_EQUAL
DATE_LESS_THAN_OR_EQUAL
STARTS_WITH
DOES_NOT_START_WITH
CONTAINS
DOES_NOT_CONTAIN
CONTAINS_ONE_OF
CONTAINS_NONE_OF
IN
NOT_IN
BETWEEN
NOT_BETWEEN
MEMBER_OF
MISSING
NOT_MISSING
MV_INDICATOR
NO_MV_INDICATOR
Q
ONTOLOGY_IN_SUBTREE
ONTOLOGY_NOT_IN_SUBTREE
EXP_CHILD_OF
EXP_PARENT_OF
EXP_LINEAGE_OF
When using the MISSING, NOT_MISSING, MV_INDICATOR, or NO_MV_INDICATOR operators, an empty string should be supplied as the value. See example below.
The function returns either a single string or an array of strings to be use in the
colFilter argument of the labkey.selectRows function. By default, this function will return an array
of LabKey filter parameters/values that are URL encoded and can be directly applied to a request URL. If the asList argument
is set to TRUE, the function will return a list with named elements where the name is the parameter name and the element
value is the filter value. This format can be useful when needing to build URLs that need to be combined with other
parameters or can be converted directly to JSON posted parameters.
Valerie Obenchain
http://www.omegahat.net/RCurl/,
https://www.labkey.org/home/project-begin.view
labkey.selectRows
# library(Rlabkey)
## Two filters, ANDed together
makeFilter(c("TextFld","CONTAINS","h"),
c("BooleanFld","EQUAL","TRUE"))
## Using "in" operator:
makeFilter(c("RowId","IN","2;3;6"))
## Using "missing" operator:
makeFilter(c("IntFld","MISSING",""))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.