conjecture: Specialized "long to wide" reshaping

Description Usage Arguments Details Value Examples

View source: R/conjecture.R

Description

On the surface, conjecture() appears similar to tidyr::pivot_wider(), but uses different logic tailored to a specific type of dataset:

See vignette("conjecture") for more details.

Usage

1
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 values_from in pivot_wider(), but also serves as sorting dimension for underlying conjecture algorithm.

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 names_from indicating anterior observation.

Details

conjecture() uses the following routine to match elements:

  1. Values in sort_by are separated into two vectors: anterior and posterior.

  2. Each anterior element is matched with the closest posterior element measured by sort_by.

Value

An object of the same type as data.

Examples

1
2
3
# See vignette("conjecture") for more examples

conjecture(comms, timestamp, type, "send")

sift documentation built on July 5, 2021, 5:08 p.m.