R distinct()

  • The distinct() function is used to select unique/distinct rows from a data frame based on one or more columns.

Syntax

.dataA data frame, data frame extension (e.g. a tibble), or a lazy data frame (e.g. from dbplyr or dtplyr)
...<data-masking> 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 in the data frame.
.keep_allIf TRUE, keep all variables in .data. If a combination of ... is not distinct, this keeps the first row of values.

Example

Example 2

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top