find_triples: find_triples

View source: R/find_triples.R

find_triplesR Documentation

find_triples

Description

A general-purpose function to count how many triples of numerics occur in a vector within a fixed interval of one another.

find_triples will begin a searching for the next triple at the index of the final member of the most recently found triple.

Usage

find_triples(x, from = 4.0, to = 12.0)

Arguments

x

a vector of type numeric

from

a numeric lower bound for the length between two observations

to

a numeric upper bound for the length between two observations

Value

An integer representing the number of triples.

Author(s)

Sandy Floren

Examples


# 1 triple
 find_triples(c(0, 4, 12, 16))

# No triples
find_triples(c(0, 12, 25))

# 2 triples
find_triples(c(0, 12, 24, 36, 48))


saviclab/savictools documentation built on Dec. 7, 2023, 11:56 p.m.