makeFilter {Rlabkey}R Documentation

Builds filters to be used in labkey.selectRows

Description

This function takes inputs of column name, filter value and filter operator and returns an array of filters to be used in labkey.selectRows.

Usage

makeFilter(...)

Arguments

... Arguments in c("colname","operator","value") form, used to create a filter.

Details

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.

colname
a string specifying the name of the column to be filtered
operator
a string specifying what operator should be used in the filter (see options below)
value
an integer or string specifying the value the columns should be filtered on

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.

Value

The function returns either a single string or an array of strings to be use in the colFilter argument of the labkey.selectRows function.

Author(s)

Valerie Obenchain

References

http://www.omegahat.org/RCurl/,
http://dssm.unipa.it/CRAN/web/packages/rjson/rjson.pdf,
https://www.labkey.org/project/home/begin.view

See Also

labkey.selectRows

Examples

## 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)



[Package Rlabkey version 0.0.7 Index]