split_vec: Split vector into list

Description Usage Arguments Value Examples

View source: R/helpers.R

Description

This function splits a vector from the index start to the index end into segments of length length and complies them into a list. This function can also apply the exponential function to the vector elements if desired.

Usage

1

Arguments

vector

The vector to be split into a list.

start

The first index of the vector vector that will be included in the list.

end

The last index of the vector vector that will be included in the list.

length

A value indicating the length of the segments that vector will be split into.

exp

A logical variable indicating whether the elements of vector should be transformed with exp().

Value

A list of the sections of the split vector.

Examples

1
2
split_vec(c(1, 2, 3, 4, 5, 6, 7, 8, 9), 3, 6, 2)
split_vec(c(0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6), 2, 7, 3, exp = TRUE)

simonecollier/lizardHMM documentation built on Dec. 23, 2021, 2:24 a.m.