Adjoin a dataset to itself
This function binds a dataset to itself along adjacent pairs of a key
variable. It is invoked by geom_flow() to convert data in lodes
form to something similar to alluvia form.
self_adjoin(
  data,
  key,
  by = NULL,
  link = NULL,
  keep.x = NULL,
  keep.y = NULL,
  suffix = c(".x", ".y")
)data | 
 A data frame in lodes form (repeated measures data; see
  | 
key | 
 Column of   | 
by | 
 Character vector of variables to self-adjoin by; passed to
  | 
link | 
 Character vector of variables to adjoin. Will be replaced by
pairs of variables suffixed by   | 
keep.x, keep.y | 
 Character vector of variables to associate with the
first (respectively, second) copy of   | 
suffix | 
 Suffixes to add to the adjoined   | 
self_adjoin invokes dplyr::mutate-joins functions in order to convert
a dataset with measures along a discrete key variable into a dataset
consisting of column bindings of these measures (by any by variables) along
adjacent values of key.
Other alluvial data manipulation: 
alluvial-data
# self-adjoin `majors` data
data(majors)
major_changes <- self_adjoin(majors, key = semester,
                             by = "student", link = c("semester", "curriculum"))
major_changes$change <- major_changes$curriculum.x == major_changes$curriculum.y
head(major_changes)
# self-adjoin `vaccinations` data
data(vaccinations)
vaccination_steps <- self_adjoin(vaccinations, key = survey, by = "subject",
                                 link = c("survey", "response"),
                                 keep.x = c("freq"))
head(vaccination_steps)
vaccination_steps <- self_adjoin(vaccinations, key = survey, by = "subject",
                                 link = c("survey", "response"),
                                 keep.x = c("freq"),
                                 keep.y = c("start_date", "end_date"))
head(vaccination_steps)Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.