substr_by_cha: Divide character strings given a certain character.

Description Usage Arguments Value Author(s) Examples

View source: R/substr_by_cha.R

Description

This is a handy function to divide character strings given a certain character. This is especially useful when sometimes gene names show up in the form of "GENESYMBOL|ENTREZID"

Usage

1
  substr_by_cha(cha_str, delim = "|", type = c("before", "after"))

Arguments

cha_str

A character string or a vector of character string.

delim

Delimiter character. Default is "|".

type

Return the partial character string before or after the delimiter.

Value

Return the desired substring (an individual or a vector).

Author(s)

Yuhang Liu, Xing Qiu, Jinfeng Zhang, and Zihan Cui

Examples

1
2
3
4
  substr_by_cha("ABCB1|5243", delim = "|", type = "before")
  ## [1] "ABCB1"
  substr_by_cha(c("ABCB1-5243", "ABL1-25", "ABL2-27"), delim = "-", type = "after")
  ## [1] "5243"  "25"  "27"

fhlsjs/superdelta2 documentation built on Sept. 15, 2020, 12:03 a.m.