Remove Duplicate Elements from an Object in R Programming - unique() Function Last Updated : 04 Jun, 2020 Comments Improve Suggest changes Like Article Like Report unique() function in R Language is used to remove duplicated elements/rows from a vector, data frame or array. Syntax: unique(x) Parameters: x: vector, data frame, array or NULL Example 1: Python3 # R program to illustrate # unique function # Initializing some set of numbers x <- c(1:10, 5:9) x # Calling unique() function to print # unique set of numbers unique(x) Output: [1] 1 2 3 4 5 6 7 8 9 10 5 6 7 8 9 [1] 1 2 3 4 5 6 7 8 9 10 Example 2: Python3 # R program to illustrate # unique function # Initializing a matrix x <- matrix(rep(1:9, length.out = 18), nrow = 6, ncol = 3, byrow = T) x # Calling unique() function to print # unique set of numbers in the matrix unique(x) Output: [, 1] [, 2] [, 3] [1, ] 1 2 3 [2, ] 4 5 6 [3, ] 7 8 9 [4, ] 1 2 3 [5, ] 4 5 6 [6, ] 7 8 9 [, 1] [, 2] [, 3] [1, ] 1 2 3 [2, ] 4 5 6 [3, ] 7 8 9 Comment More infoAdvertise with us Next Article Remove Duplicate Elements from an Object in R Programming - unique() Function K Kanchan_Ray Follow Improve Article Tags : R Language R DataFrame-Function R Vector-Function R Object-Function R Matrix-Function +1 More Similar Reads Remove names or dimnames from an Object in R Programming - unname() Function unname() function in R Language is used to remove the names or dimnames from an Object. Syntax: unname(x) Parameters: x: Object Example 1: Python3 1== # R Program to remove names from an object # Creating a matrix A = matrix(c(1:9), 3, 3) # Naming rows rownames(A) = c("a", "b", 1 min read Removing Levels from a Factor in R Programming - droplevels() Function droplevels() function in R programming used to remove unused levels from a Factor. Syntax: # For vector object droplevels(x, exclude = if(anyNA(levels(x))) NULL else NA, ...) # For data frame object droplevels(x, except, exclude) Parameter values: x represents object from which unused level has to b 2 min read Remove Objects from Memory in R Programming - rm() Function rm() function in R Language is used to delete objects from the memory. It can be used with ls() function to delete all objects. remove() function is also similar to rm() function. Syntax: rm(x) Parameters: x: Object name Example 1: Python3 1== # R Program to remove # objects from Memory # Creating a 2 min read Convert an Object to Data Frame in R Programming - as.data.frame() Function as.data.frame() function in R Programming Language is used to convert an object to data frame. These objects can be Vectors, Lists, Matrices, and Factors. Syntax: as.data.frame(object) Parameters: object: Vector, Matrix, factor, or data frameR - as.data.frame() Function ExampleExample 1: Basic exam 2 min read Make Elements of a Vector Unique in R Programming - make.unique() Function make.unique() function in R Language is used to return elements of a vector with unique names by appending sequence numbers to duplicates. Syntax: make.unique(names, sep)Parameters: names: Character vector with duplicate names sep: Separator to be used  Example 1: Python3 # R program to make uniqu 1 min read Like