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

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.

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","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)



[Package Rlabkey version 0.0.4 Index]