mapValue: mapValue()

Description Usage Arguments Value Note Examples

View source: R/helper_functions.R

Description

Given a list x, and a named list of y. Map the values of y to x based on the names of y.

Usage

1
mapValue(x, y, verbose = F)

Arguments

x

A list with values to be mapped

y

A named list, where names(y) correponding to the value in x, and values

Value

A named list of the new mapped values

Note

The named list of y must contain all values of x in names(y). The returned list is the same order as x.

Examples

1
2
3
x <- c(rep("WT", 3), rep("Rasgrf1_KO", 3))
y <- c(Rasgrf1_KO = "#2", WT = "#1", WT2 = "#3")
mapValue(x,y)

BerylZhuang/helper_functions documentation built on March 15, 2021, 5:19 a.m.