dropduplicates

Purpose

Drops duplicate observations from data.

Format

x_new = dropduplicates(x[, varlist])
Parameters:
  • x (matrix or dataframe) – data

  • varlist (string array) – Optional, list of variables to include in the check for duplicates. Default is across all variables.

Returns:

dup_report (dataframe) – Returns a dataframe with duplicate observations from x removed.

Examples

new;

// Create file name with full path
fname = getGAUSSHome("examples/tips2.dta");

// Load the dataframe
tips2 = loadd(fname);

// Locate and remove the duplicate observations
tips_no_dups = dropduplicates(tips2);

See also

Functions getduplicates(), isunique()