index_func_df: Get the occurence of duplicate combinations of variables in a...

View source: R/index_func_df.R

index_func_dfR Documentation

Get the occurence of duplicate combinations of variables in a data frame.

Description

Similar to my other function index_func, this one is more appropriate if you are checking for duplciate values across more than one column.

Usage

index_func_df(data, ...)

Arguments

data

A data frame or tibble

...

Unquoted variable names to search for duplicates.

Value

Returns a data.frame (actually a tbl_df) with the full records and a variable dupe_count showing the number of rows sharing a combination of the specified variables have duplicated values duplicated values; shows the increasing number, i.e. the occurence.

Examples

library(tibble)
bar <- tibble::tribble(
  ~var1, ~var2, ~var3,
     4L,    4L,    1L,
    23L,   23L,    3L,
     4L,    4L,    3L,
    23L,   23L,    2L,
     5L,    5L,    1L,
    43L,   43L,    3L,
    54L,   54L,    1L,
    56L,   56L,    2L,
   657L,  657L,    2L,
    67L,   67L,    1L,
    67L,   67L,    2L,
   435L,  435L,    1L,
   453L,  453L,    2L,
   435L,  435L,    2L,
   324L,  324L,    3L,
    34L,   34L,    1L,
   456L,  456L,    1L,
    56L,   56L,    1L,
   567L,  567L,    3L,
    65L,   65L,    4L,
    34L,   34L,    2L,
   435L,  435L,    3L
  )

index_func_df(bar)
index_func_df(bar, var1)
index_func_df(bar, var1, var3)

emilelatour/lamisc documentation built on April 9, 2024, 10:33 a.m.