makeFilter {Rlabkey} | 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
.
makeFilter(...)
... |
Arguments in c("colname","operator","value") form, used to create a filter. |
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.
Operator values:
EQUAL
NOT_EQUAL
NOT_EQUAL_OR_MISSING
DATE_EQUAL
DATE_NOT_EQUAL
MISSING
NOT_MISSING
GREATER_THAN
GREATER_THAN_OR_EQUAL
LESS_THAN
LESS_THAN_OR_EQUAL
CONTAINS
DOES_NOT_CONTAIN
STARTS_WITH
DOES_NOT_START_WITH
EQUALS_ONE_OF
When using the MISSING or NOT_MISSING 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.
Valerie Obenchain
http://www.omegahat.org/RCurl/,
http://dssm.unipa.it/CRAN/web/packages/rjson/rjson.pdf,
https://www.labkey.org/project/home/begin.view
## These example datasets are located at ## https://www.labkey.org/project/home/Study/demo/begin.view? ## Two filters: filter1<- makeFilter(c("HIVLoadQuant","GREATER_THAN",500), c("HIVRapidTest","EQUAL","Positive")) ## Using "equals one of" operator: filter2 <- makeFilter(c("HIVLoadIneq","EQUALS_ONE_OF","Equals ; Less than")) ## Using "not missing" operator: filter3 <- makeFilter(c("HIVRapidTest","NOT_MISSING","")) ## Apply a filter in labkey.selectRows function getdata <- labkey.selectRows( baseUrl="https://www.labkey.org", folderPath="/home/Study/demo", schemaName="study", queryName="HIV Test Results", colSelect=c("ParticipantId","HIVDate","HIVLoadQuant","HIVRapidTest"), colFilter=filter3)