function in R Language is used to return elements of a vector with unique names by appending sequence numbers to duplicates.**make.unique()**

Syntax:make.unique(names, sep)

Parameters:

names:Character vector with duplicate names

sep:Separater to be used

**Example 1:**

`# R program to make unique vectors ` ` ` `# Calling make.unique() Function ` `make.unique(c(` `"a"` `, ` `"a"` `, ` `"a"` `)) ` `make.unique(c(` `"a"` `, ` `"b"` `, ` `"c"` `, ` `"a"` `)) ` `make.unique(c(` `"1"` `, ` `"2"` `, ` `"3"` `, ` `"1"` `, ` `"2"` `)) ` |

*chevron_right*

*filter_none*

**Output:**

[1] "a" "a.1" "a.2" [1] "a" "b" "c" "a.1" [1] "1" "2" "3" "1.1" "2.1"

**Example 2:**

`# R program to make unique vectors ` ` ` `# Calling make.unique() Function ` `# with different separater values ` `make.unique(c(` `"a"` `, ` `"a"` `, ` `"a"` `), sep ` `=` `"_"` `) ` `make.unique(c(` `"a"` `, ` `"a"` `, ` `"a"` `), sep ` `=` `"@"` `) ` `make.unique(c(` `"a"` `, ` `"a"` `, ` `"a"` `), sep ` `=` `"$"` `) ` |

*chevron_right*

*filter_none*

**Output:**

[1] "a" "a_1" "a_2" [1] "a" "a@1" "a@2" [1] "a" "a$1" "a$2"

## Recommended Posts:

- Convert an Object into a Vector in R Programming - as.vector() Function
- Check for the Existence of a Vector Object in R Programming - is.vector() Function
- Create a Vector of Colors from a Vector of Gray Levels in R Programming - gray() or grey() Function
- Generate a Vector of specified length with each element as a unique color on RGB scale in R Language - topo.colors() Function
- Generate a Vector of specified length with each element as a unique color on RB scale in RGB spectrum in R Language - cm.colors() Function
- Generate a Vector of specified length with each element as a unique color on RG scale in RGB spectrum in R Language - terrain.colors() Function
- Add Leading Zeros to the Elements of a Vector in R Programming - Using paste0() and sprintf() Function
- Check if Elements of a Vector are non-empty Strings in R Programming - nzchar() Function
- Replace the Elements of a Vector in R Programming - replace() Function
- Creating a Vector of sequenced elements in R Programming - seq() Function
- Check if the elements of a Vector are Finite, Infinite or NaN values in R Programming - is.finite(), is.infinite() and is.nan() Function
- Calculate the difference between Consecutive pair of Elements of a Vector in R Programming - diff() Function
- Calculate Median of elements of a Vector in R Programming - median() Function
- Get the Sign of Elements of a Numeric Vector in R Programming - sign() Function
- Seeking a unique match of elements in R Programming - char.expand() Function
- Remove Duplicate Elements from an Object in R Programming - unique() Function
- Replicate elements of vector in R programming - rep() Method
- Adding elements in a vector in R programming - append() method
- Compute the gamma value of a Non-negative Numeric Vector in R Programming - gamma() Function
- Check if values in a vector are True or not in R Programming - all() and any() Function

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.