Learn R Programming

Tivy (version 0.1.1)

get_length_range: Get length range from frequencies

Description

Finds the minimum or maximum length with positive frequency.

Usage

get_length_range(frequency, length, type = "min")

Value

Minimum or maximum length value with frequency > 0.

Arguments

frequency

Numeric vector of length frequencies.

length

Numeric vector of corresponding lengths.

type

Either "min" or "max" to specify which range to return.

Examples

Run this code
freq <- c(0, 0, 1, 2, 3, 4, 2, 1, 0)
lengths <- c(5, 6, 7, 8, 9, 10, 11, 12, 13)
min_length <- get_length_range(freq, lengths, type = "min")
max_length <- get_length_range(freq, lengths, type = "max")

Run the code above in your browser using DataLab