Split_Vector: Split vector into list

View source: R/Utilities.R

Split_VectorR Documentation

Split vector into list

Description

Splits vector into chunks of x sizes

Usage

Split_Vector(x, chunk_size = NULL, num_chunk = NULL, verbose = FALSE)

Arguments

x

vector to split

chunk_size

size of chunks for vector to be split into, default is NULL. Only valid if num_chunk is NULL.

num_chunk

number of chunks to split the vector into, default is NULL. Only valid if chunk_size is NULL.

verbose

logical, print details of vector and split, default is FALSE.

Value

list with vector of X length

References

Base code from stackoverflow post: https://stackoverflow.com/a/3321659/15568251

Examples

vector <- c("gene1", "gene2", "gene3", "gene4", "gene5", "gene6")

vector_list <- Split_Vector(x = vector, chunk_size = 3)


samuel-marsh/scCustomize documentation built on Dec. 20, 2024, 7:41 a.m.