select.blocks.gt.length: Select blocks of TRUE values of sufficient length.

View source: R/indices.R

select.blocks.gt.lengthR Documentation

Select blocks of TRUE values of sufficient length.

Description

Produces a sequence of booleans of the same length as input, with sequences of TRUE values shorter than n replaced with FALSE.

This function takes a series of booleans and returns a sequence of booleans of equal length, with all sequences of TRUE of length n or shorter replaced with sequences of FALSE. NA values are replaced with na.value.

Usage

select.blocks.gt.length(d, n, na.value = FALSE)

Arguments

d

Sequence of booleans.

n

Longest sequence of TRUE to replace with FALSE.

na.value

Values to replace NAs with.

Value

A vector of booleans, with the length n or less sequences of TRUE replaced with FALSE.

Examples


## Return only the first sequence of TRUE... second sequence will be FALSE.
foo <- select.blocks.gt.length(c(rep(TRUE, 4), FALSE, rep(TRUE, 3)), 3)


ECA-D/climind documentation built on Nov. 26, 2022, 10:20 a.m.