split_data: Split Large Vector or DataFrame

View source: R/diff-ml-utilities.R

split_dataR Documentation

Split Large Vector or DataFrame

Description

Split large vector or dataframe to list class, which contian subset vectors or dataframe of origin vector or dataframe.

Usage

split_data(x, nums, chunks = NULL, random = FALSE)

Arguments

x

vector class or data.frame class.

nums

integer.

chunks

integer. use chunks if nums is missing. Note nums and chunks shouldn't concurrently be NULL, default is NULL.

random

bool, whether split randomly, default is FALSE, if you want to split data randomly, you can set TRUE, and if you want the results are reproducible, you should add seed before.

Value

the subset of x, vector or data.frame class.

Author(s)

Shuangbin Xu

Examples

data(iris)
irislist <- split_data(iris, 40)
dalist <- c(1:100)
dalist <- split_data(dalist, 30)

xiangpin/MicrobiotaProcess documentation built on Nov. 12, 2024, 2:05 p.m.