rename_duplicates: Make a list of strings unique

View source: R/utility_functions.R

rename_duplicatesR Documentation

Make a list of strings unique

Description

It might happen that there are duplicated strings in a list. With this function we will rename those duplicated entries in a way that we simply add the number of occurrences to the string. I.e., when the string foo occurs three times in a list, it will be renamed to foo_1, foo_2, and foo_3, respectively.

Usage

rename_duplicates(names)

Arguments

names

List of strings where duplicates should be renamed

Value

List where duplicates are renamed.

Examples

l <- c("foo", "bar", "foo", "bars")
rename_duplicates(l)


yigbt/multiGSEA documentation built on Oct. 31, 2024, 2:22 p.m.