Learn R Programming

Rlabkey (version 2.8.0)

makeFilter: Builds filters to be used in labkey.selectRows and getRows

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 and getRows.

Usage

makeFilter(...)

Arguments

...

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

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.

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

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.

References

http://www.omegahat.net/RCurl/, https://www.labkey.org/project/home/begin.view

See Also

labkey.selectRows

Examples

Run this code
# NOT RUN {
# 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",""))

# }

Run the code above in your browser using DataLab