uncollapse: Uncollapse/Recollapse

uncollapseR Documentation

Uncollapse/Recollapse

Description

Uncollapse data.table cols

Usage

uncollapse(dt, ..., sep = ";")

recollapse(dt, by, sep = ";")

Arguments

dt

data.table

...

cols

sep

string

by

string

Examples

# Example data
   (dt <- data.table::data.table(
              uniprot  = 'Q9BQL6;Q96AC1;Q96AC1-3', 
              protein  = 'FERM1_HUMAN;FERM2_HUMAN', 
              gene     = 'FERMT1;FERMT2', 
              family   = 'FERM'))
# Uncollapse
    uncollapse(dt, protein, gene, sep = ';')
    recollapse( uncollapse(dt, protein, gene, sep = ';'), by = 'uniprot')
    
# Unchanged when no sep
    uncollapse(dt, family, sep = ';')
    uncollapse(dt, family, sep = 'NOSEP')

bhagwataditya/importomics documentation built on Nov. 28, 2024, 8:28 a.m.