ganalytics (version 0.10.7)

comparators: Comparison operators

Description

Binary operators used to define Google Analytics filters and segments.

Usage

var %starts_with% operand

var %ends_with% operand

var %contains% operand

var %matches% operand

var %between% operand

x %in% table

# S4 method for .var,.dimOperand %matches%(var, operand)

# S4 method for .var,.dimOperand %starts_with%(var, operand)

# S4 method for .var,.dimOperand %ends_with%(var, operand)

# S4 method for .var,.dimOperand %contains%(var, operand)

# S4 method for .var,.operand %between%(var, operand)

# S4 method for .var,.operand %in%(x, table)

# S4 method for .var,.operand ==(e1, e2)

# S4 method for .var,.operand !=(e1, e2)

# S4 method for .var,.metOperand >(e1, e2)

# S4 method for .var,.metOperand <(e1, e2)

# S4 method for .var,.metOperand >=(e1, e2)

# S4 method for .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 (<code>==</code>)

Do the values on the left and right match exactly.

Not equal-to (<code>!=</code>)

Do the values on the left and right not match.

Greater-than (<code>&gt;</code>)

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

Less-than (<code>&lt;</code>)

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

Greater-than-or-equal-to (<code>&gt;=</code>)

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

Less-than-or-equal-to (<code>&lt;=</code>)

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

See Also

Other comparator functions: Comparator

Examples

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

Run the code above in your browser using DataLab