remap: Map dataframe column, vector, or list of vectors

Description Usage Arguments Value

View source: R/utils.R View source: R/remap.R

Description

Use a user-provided look-up table, df_mapping, to map a vector. Handle NAs and collapse duplicates.

Usage

1
2
3
4
5
6
7
8
9
remap(
  dataIn,
  colRemap = NULL,
  df_mapping,
  from = "hgnc",
  to = "ensembl",
  replace = F,
  na.rm = T
)

Arguments

dataIn

data.frame or data.table with a column or rownames containing genes to remap,

colRemap

if dataIn is a dataframe, the name of the column to remap; in this case NULL implies rownames

df_mapping

data.frame or coercible with columns corresponding to 'from' and 'to' arguments (using grep partial matching)

from

df_mapping colname to map from

to

df_mapping colname to map to

replace

boolean; if dataIn is a data.frame, TRUE replaces original, FALSE adds a new column to the data.frame

na.rm

boolean; remove rows that fail to map or leave them as NAs?; defaults to TRUE

Value

an object of the same format as dataIn with new gene names


CBMR-Single-Cell-Omics-Platform/SCOPfunctions documentation built on May 29, 2021, 3:52 p.m.