splitDfRegex: Split data frame or matrix using regex on colnames

View source: R/splitDfRegex.R

splitDfRegexR Documentation

Split data frame or matrix using regex on colnames

Description

Split data frame or matrix using regex on colnames

Usage

splitDfRegex(df, patterns, return.remainder = T, names = NULL)

Arguments

df

A data frame of matrix

patterns

A vector/list of regular expressions. If arguments are named, or items in the vector/list are named, the items in the output list will also be named accordingly

return.remainder

Return columns which don't match the given regular expressions?

Value

A list of data frames or matrices

Examples

## Will return a list containing the corresponding names
splitDfRegex(df = contexts, patterns = list(snv = '\\[', indel = '[.]', sv = '[A-Z]{3}'))

## The same output list as above, but without names
splitDfRegex(df = contexts, patterns = list('\\[', '[.]', '[A-Z]{3}'))

UMCUGenetics/mutSigExtractor documentation built on Aug. 30, 2024, 2:12 p.m.