comparators: Comparison operators

Description Usage Arguments Value %starts_with% %ends_with% %contains% %matches% %between% %in% Equal-to (==) Not equal-to (!=) Greater-than (>) Less-than (<) Greater-than-or-equal-to (>=) Less-than-or-equal-to (<=) See Also Examples

Description

Binary operators used to define Google Analytics filters and segments.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
var %starts_with% operand

var %ends_with% operand

var %contains% operand

var %matches% operand

var %between% operand

x %in% table

## S4 method for signature '.var,.dimOperand'
var %matches% operand

## S4 method for signature '.var,.dimOperand'
var %starts_with% operand

## S4 method for signature '.var,.dimOperand'
var %ends_with% operand

## S4 method for signature '.var,.dimOperand'
var %contains% operand

## S4 method for signature '.var,.operand'
var %between% operand

## S4 method for signature '.var,.operand'
x %in% table

## S4 method for signature '.var,.operand'
e1 == e2

## S4 method for signature '.var,.operand'
e1 != e2

## S4 method for signature '.var,.metOperand'
e1 > e2

## S4 method for signature '.var,.metOperand'
e1 < e2

## S4 method for signature '.var,.metOperand'
e1 >= e2

## S4 method for signature '.var,.metOperand'
e1 <= e2

Arguments

var

The name of a single Google Analytics dimension or metric, as a character string or a .var object generated with Var.

operand

An operand appropriate to the selected var and comparison operator. A vector usually of length-one, or exactly length-two in the case of %between%, or at least length-two in the case of %in%. Usually either a character string or numeric value.

x

A dimension.

table

A vector of possible values within that dimension.

e1

A dimension or metric.

e2

An operand object of length-one.

Value

an expr object.

%starts_with%

A condition where the dimension (LHS) matches values that start with the character string given by the operand (RHS).

%ends_with%

A condition where the dimension (LHS) matches values that end with the character string given by the operand (RHS).

%contains%

A condition where the dimension (LHS) matches values that contain the character string given by the operand (RHS).

%matches%

A condition where the dimension (LHS) matches a regular expression given by the operand (RHS).

%between%

A condition where the var (LHS) is within the lower and upper bounds specified by first and second vector value (respectively) of the operand (RHS).

%in%

A condition where the dimension (LHS) matches one of the values in the vector specified by the operand (RHS).

Equal-to (==)

Do the values on the left and right match exactly.

Not equal-to (!=)

Do the values on the left and right not match.

Greater-than (>)

Is the value on the left greater than the value on the right.

Less-than (<)

Is the value on the left less than the value on the right.

Greater-than-or-equal-to (>=)

Is the value on the left greater than or equal to the value on the right.

Less-than-or-equal-to (<=)

Is the value on the left less than or equal to the value on the right.

See Also

Other comparator functions: Comparator

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
Expr(~PagePath %starts_with% "/products")
Expr(~PagePath %ends_with% "/index.html")
Expr(~PagePath %contains% "thank-you")
Expr(~PagePath %matches% "*.thank[\\-_]?you.*")
Expr(~transactionRevenue %between% c(200, 500))
Expr(~browser %in% c("Chrome", "Firefox"))
Expr(~productName == "apple")
Expr(~bounces == 0)
Expr(~deviceCategory != "tablet")
Expr(~sessionDuration != 0)
Expr(~pageviews > 100)
Expr(~exits < 100)

jdeboer/ganalytics documentation built on May 18, 2019, 11:30 p.m.