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:

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 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

# See vignette("conjecture") for more examples

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

[Package sift version 0.1.0 Index]