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.