df <- data.frame(
x = sample(10, 100, rep = TRUE),
y = sample(10, 100, rep = TRUE)
)
nrow(df)
nrow(distinct(df))
distinct(df, x)
distinct(df, y)
# You can also use distinct on computed variables
distinct(df, diff = abs(x - y))
Run the code above in your browser using DataCamp Workspace