iv_align {ivs}R Documentation

Align after locating relationships

Description

iv_align() will align/join needles and haystack together using a data frame of locations. These locations are intended to be the output of one of: iv_locate_overlaps(), iv_locate_precedes(), iv_locate_follows(), iv_locate_relates(), or iv_locate_between().

This is mainly a convenience function that slices both needles and haystack according to those locations, and then stores the result in a new two column data frame.

Usage

iv_align(needles, haystack, ..., locations)

Arguments

needles, haystack

⁠[vector]⁠

Two vectors to align.

...

These dots are for future extensions and must be empty.

locations

⁠[two-column data frame]⁠

The data frame of locations returned from one of iv_locate_overlaps(), iv_locate_precedes(), iv_locate_follows(), iv_locate_relates(), or iv_locate_between().

Value

A two column data frame with a ⁠$needles⁠ column containing the sliced version of needles and a ⁠$haystack⁠ column containing the sliced version of haystack.

Examples

needles <- iv_pairs(c(1, 5), c(3, 7), c(10, 12))
haystack <- iv_pairs(c(0, 2), c(4, 6))

locations <- iv_locate_overlaps(needles, haystack)
iv_align(needles, haystack, locations = locations)

locations <- iv_locate_overlaps(needles, haystack, no_match = "drop")
iv_align(needles, haystack, locations = locations)

needles <- c(1, 15, 4, 11)
haystack <- iv_pairs(c(1, 5), c(3, 7), c(10, 12))

locations <- iv_locate_between(needles, haystack)
iv_align(needles, haystack, locations = locations)

[Package ivs version 0.2.0 Index]