Learn R Programming

StatMeasures (version 1.0)

rmdupobs: Remove duplicate observations from data

Description

Takes in a data, and returns it with duplicate observations removed

Usage

rmdupobs(data)

Arguments

data
a data.frame or data.table

Value

a data of same class as input with only unique observations

Details

Duplicate observations are redundant and they need to be removed from the data. rmdupobs does just that; it removes the duplicated observations (the ones in which value of every variable is duplicated) and returns the data with only unique observations.

It works for both 'data.frame' and 'data.table' and returns the data with same class as that of input.

See Also

randomise, rmdupkey, factorise

Examples

Run this code
# A 'data.frame'
df <- data.frame(x = c(1, 2, 5, 1), y = c(3, 3, 1, 3))

# Remove duplicate observations from data
dfUnq <- rmdupobs(data = df)

Run the code above in your browser using DataLab