|
a |
|
b/man/rename_duplicates.Rd |
|
|
1 |
% Generated by roxygen2: do not edit by hand |
|
|
2 |
% Please edit documentation in R/utility_functions.R |
|
|
3 |
\name{rename_duplicates} |
|
|
4 |
\alias{rename_duplicates} |
|
|
5 |
\title{Make a list of strings unique} |
|
|
6 |
\usage{ |
|
|
7 |
rename_duplicates(names) |
|
|
8 |
} |
|
|
9 |
\arguments{ |
|
|
10 |
\item{names}{List of strings where duplicates should be renamed} |
|
|
11 |
} |
|
|
12 |
\value{ |
|
|
13 |
List where duplicates are renamed. |
|
|
14 |
} |
|
|
15 |
\description{ |
|
|
16 |
It might happen that there are duplicated strings in a list. With this |
|
|
17 |
function we will rename those duplicated entries in a way that we simply add |
|
|
18 |
the number of occurrences to the string. I.e., when the string foo occurs |
|
|
19 |
three times in a list, it will be renamed to foo_1, foo_2, and foo_3, |
|
|
20 |
respectively. |
|
|
21 |
} |
|
|
22 |
\examples{ |
|
|
23 |
l <- c("foo", "bar", "foo", "bars") |
|
|
24 |
rename_duplicates(l) |
|
|
25 |
|
|
|
26 |
} |