pair_links | R Documentation |
ggmark()
and cross_link()
allow users to add links between
observations. These functions help define the linked observations. The
selected pairs will either be linked together, or each group in the pair will
be linked separately to the same plot area.
pair_links
: Helper function to create pairs of observation groups.
range_link
: Helper function to create a range of observations.
pair_links(..., .handle_missing = "error", .reorder = NULL)
range_link(point1, point2)
... |
<dyn-dots> A list of formulas, where each side
of the formula should be an |
.handle_missing |
A string of |
.reorder |
A string of |
point1 , point2 |
A single integer or character index, defining the lower
and higher bounds of the range. For integer indices, wrap them with |
x <- pair_links(
# group on the left hand only
c("a", "b"),
# normally, integer index will be interpreted as the index of the
# origianl data
1:2,
# wrapped with `I()` indicate` the integer index is ordering of the
# layout
I(1:2),
range_link(1, 6),
range_link("a", "b"),
# group on the right hand only
~ 1:2,
~ c("a", "b"),
~ range_link(1, 6),
# group on the both side
range_link(1, 6) ~ c("a", "b"),
# waiver() indicates the right hand is the same of the left hand
range_link(1, 6) ~ waiver(),
# the same for the left hand
waiver() ~ 1:2,
~NULL # an empty link
)
x
# we can modify it as usual list
x[[1]] <- NULL # remove the first link
x$a <- ~LETTERS
x
# modify with a list
x[1:2] <- list(~ c("a", "b"), ~ range_link("a", "b"))
x
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.