Last updated: July 18, 2020
# Show duplicates df %>% filter(duplicated(.$column_name)) # Show both the original and duplicate rows dupes <- df %>% filter(duplicated(.$column_name)) df %>% filter(column_name %in% dupes$column_name) %>% arrange(column_name) # Delete duplicates df <- df %>% distinct(column_name, .keep_all = TRUE)
ℹ️ This page is part of my knowledge base for R, the popular statistical programming language. I attempt to use idiomatic practices with the
tidyverse collection of packages as much as possible. If you have suggestions for ways to improve this code, please contact me or use the survey link below..