[72a7c3]: / man / rename_duplicates.Rd

Download this file

27 lines (25 with data), 739 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utility_functions.R
\name{rename_duplicates}
\alias{rename_duplicates}
\title{Make a list of strings unique}
\usage{
rename_duplicates(names)
}
\arguments{
\item{names}{List of strings where duplicates should be renamed}
}
\value{
List where duplicates are renamed.
}
\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.
}
\examples{
l <- c("foo", "bar", "foo", "bars")
rename_duplicates(l)
}