knitr::opts_chunk$set(echo = TRUE)

Interpolate the locations of values within an ordered vector viewed from left to right.

Inpsired by locate() from numerical recipes, base::findInterval() and VALUE_LOCATE() from IDL.

Requirements

Installation

remotes::install_github("BigelowLab/locate")

Examples

library(locate)

x <- c(13, 7, 22)
locate(x, 10:19)
locate(x, 19:10)

x <- c("zoo", "dog", "fish", "cat")
locate(x, letters)
locate(x, letters, USE.NAMES = FALSE)


BigelowLab/locate documentation built on Dec. 17, 2021, 10:51 a.m.