conjecture {sift} | R Documentation |
Specialized "long to wide" reshaping
Description
On the surface, conjecture()
appears similar to tidyr::pivot_wider()
, but uses different logic tailored to a specific type of dataset:
column corresponding to
names_from
contains only 2 levelsthere is no determinate combination of elements to fill 2 columns per row.
See vignette("conjecture") for more details.
Usage
conjecture(data, sort_by, names_from, names_first)
Arguments
data |
A data frame to reshape. |
sort_by |
Column name, as symbol. Plays a similar role as |
names_from |
Column name, as symbol. Used to differentiate anterior/posterior observations. Column must only contain 2 levels (missing values not allowed). |
names_first |
level in variable specified by |
Details
conjecture()
uses the following routine to match elements:
Values in
sort_by
are separated into two vectors: anterior and posterior.Each anterior element is matched with the closest posterior element measured by
sort_by
.
Value
An object of the same type as data
.
Examples
# See vignette("conjecture") for more examples
conjecture(comms, timestamp, type, "send")