I have read a CSV file into an R data.frame. Some of the rows have the same element in one of the columns. I would like to remove rows that are duplicates in th
CSV
With sqldf:
sqldf
# Example by Mehdi Nellen a <- c(rep("A", 3), rep("B", 3), rep("C",2)) b <- c(1,1,2,4,1,1,2,2) df <-data.frame(a,b)
Solution:
library(sqldf) sqldf('SELECT DISTINCT * FROM df')
Output:
a b 1 A 1 2 A 2 3 B 4 4 B 1 5 C 2