dupsBetweenGroups: Find rows of dataframe that are duplicated between groups...

Description Usage Arguments Details Value Author(s)

View source: R/merge_utils.R

Description

Find rows of dataframe that are duplicated between groups (indicated by a grouping variable).

Usage

1
dupsBetweenGroups(df, idcol, matchall = FALSE)

Arguments

df

A dataframe

idcol

The name/index of the grouping variable

matchall

If TRUE then find rows that are duplicated across ALL groups, otherwise a row only need be duplicated across 2 groups

Details

Given a dataframe df and a grouping variable idcol, this function finds which rows are the same across different groups, i.e. a row will be chosen if it is identical to another row on all variables apart from the idcol variable which should be different. If ‘matchall’ is TRUE then only rows which are the same across all groups will be chosen, otherwise rows which are the same across at least 2 groups are reported.

This function uses code by Winston Chang pinched from here: http://www.cookbook-r.com/Manipulating_data/Comparing_data_frames/

Value

A logical vector indicating which rows of df are duplicated between groups

Author(s)

Ben Veal


vapniks/mergeutils documentation built on May 3, 2019, 4:33 p.m.