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.
Possible operator values are as follows: "EQUALS", "EQUALS_ONE_OF", "NOT_EQUALS", "GREATER_THAN", "GREATER_THAN_OR_EQUAL_TO", "LESS_THAN", "LESS_THAN_OR_EQUAL_TO", "DATE_EQUAL", "DATE_NOT_EQUAL", "NOT_EQUAL_OR_NULL", "IS_MISSING", "IS_NOT_MISSING", "CONTAINS", "DOES_NOT_CONTAIN", "STARTS_WITH", and "DOES_NOT_START_WITH".
When using the "IS_MISSING" or "IS_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","EQUALS","Positive")) ## Using "equals one of" operator: filter2 <- makeFilter(c("HIVLoadIneq","EQUALS_ONE_OF","Equals ; Less than")) ## Using "is not missing" operator: filter3 <- makeFilter(c("HIVRapidTest","IS_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)