mode_selection: Logical operations under different selection mode

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/common-events.R

Description

A selection mode is essentially a logical operation like AND, OR, and XOR, etc.

Usage

1
mode_selection(x, y, mode = "none")

Arguments

x

logical: the previous selection status

y

logical: the current selection status (if y is a numeric vector, it will be converted to a logical vector of the same length with x with TRUE's corresponding to the numeric indicies)

mode

the selection mode string; see Details

Details

There are five selection modes:

none

ignore previous selection and completely start over again

and

select the intersection, i.e. the objects that are selected by two successive brushing operations

or

select the union, i.e. any objects selected by all previous operations and the current operation

xor

toggle the selection

not

negation, i.e. exclude the objects under two successive brushing operations

complement

the complement of the current selection

We can hold the key while brushing: A for 'and', O for 'or', X for 'xor', N for 'not' and C for 'complement'.

Value

a logical vector indicating whether the objects are selected

Author(s)

Yihui Xie <http://yihui.name>

See Also

&, |, xor, !

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
x1 <- c(TRUE, TRUE, FALSE, FALSE)
x2 <- c(FALSE, TRUE, TRUE, FALSE)
mode_selection(x1, x2, "none")
mode_selection(x1, x2, "and")
mode_selection(x1, x2, "or")
mode_selection(x1, x2, "xor")
mode_selection(x1, x2, "not")
mode_selection(x1, x2, "complement")

mode_selection(x1, c(2, 3), "and")  # equivalent to x2

ggobi/cranvas documentation built on May 17, 2019, 3:10 a.m.