count_dis: Count distinct/unique rows

View source: R/count_dis.R

count_disR Documentation

Count distinct/unique rows

Description

This is a pretty simple wrapper around dplyr::distinct(). I tend to do this pipe chain alot when working with data with multiple row per subjects. Making this for my own convenience more than anything else.

Usage

count_dis(.data, ..., .keep_all = FALSE)

Arguments

.data

a tbl

...

Optional variables to use when determining uniqueness. If there are multiple rows for a given combination of inputs, only the first row will be preserved. If omitted, will use all variables.

.keep_all

If ⁠TRUE``, keep all variables in ⁠.data⁠. If a combination of ⁠...“ is not distinct, this keeps the first row of values.

Value

A numeric value

Examples

library(dplyr)
library(tibble)

df <- tibble::tibble(
  x = sample(10, 100, rep = TRUE),
  y = sample(10, 100, rep = TRUE)
)

count_dis(df, x, y)
count_dis(df, x, y)

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