ItemSelection
class implements
'>Selection
for the selection of 1D and 2D regions
in plot/data space.The ItemSelection
class implements
'>Selection
for the selection of 1D and 2D regions
in plot/data space.
RegionSelection(delegate = NULL)
: Constructs
an RegionSelection
object with the underlying selection
provided by delegate
, which may be a function or any other
R object. If it is not a function, delegate
must support
coercion to a matrix
as described in the next section.
However, delegate
is usually a function that is invoked
whenever the selection is stored or retrieved. If the function is
called with no arguments, it should return the
selection. Otherwise, the argument is the new selection status,
and the function should store it. This is the same semantic as
active bindings. This dynamic
functionality allows proxying of other Selection
objects or
external sources, such as a selection model from a GUI toolkit.
Any R object can represent the underlying selection, so for simplicity
we recommend that the client interpret the selection through
coercion. Currently, there is only one supported coercion of
RegionSelection
:
as.matrix(x)
: returns a matrix with a column for each
dimension and a row for each point. In the 2D case, the points
describe one or more polygons. As with the polygon
function, polygons are separated by rows of NA
, and the last
point is connected with the first. In the 1D case, the single column
might encode, for example, selections of factor levels in an area
plot.
We will probably need to add more coercions as use cases arise. This is still very preliminary.
# NOT RUN {
## forthcoming
# }
Run the code above in your browser using DataLab