tolist_by_group: convert a vector into a list

View source: R/utils.R

tolist_by_groupR Documentation

convert a vector into a list

Description

convert x (a vector) into a list according to the group information (another vector) of elements in x.

Usage

tolist_by_group(x, group, drop = F)

Arguments

x

a vector

group

a vector with equal length of x, providing group information of elements in x

drop

drop levels of x

Value

a list. Order of elements is controled by levels of group.

Examples

tolist_by_group(x = 1:10, group = c(rep("A", 5), rep("B", 5)))


zzwch/crosslink documentation built on Aug. 27, 2023, 5:57 p.m.