split_len: Split a list or some other 'split()'-able object by lengths

View source: R/misc.utilities.R

split_lenR Documentation

Split a list or some other split()-able object by lengths

Description

split_len() splits an object, such as a list or a data frame, into subsets with specified lengths.

Usage

split_len(x, l)

Arguments

x

an object with a split() method.

l

a vector of lengths of the subsets.

Value

A list with elements of the same type as x.

Examples

x <- 1:10
l <- 1:4

o <- split_len(x, l)

stopifnot(identical(lengths(o), l))
stopifnot(identical(unlist(o), x))


statnet.common documentation built on Dec. 17, 2025, 1:06 a.m.