Skip to content
Prev 326784 / 398502 Next

simplify a dataframe

Hello,

My solution is missing a row, but maybe you can find some inspiration.


cols <- c("Matricule", "Nom", "Sexe", "DateNaissance", "contrat", "Pays")
irow1 <- duplicated(df1[, cols])
irow2 <- c(FALSE, df1$Debut[-1] == df1$Fin[-nrow(df1)])

df3 <- df1[!irow1 & !irow2, ]

dim(df2); dim(df3)  # df3 has one row less
df2; df3


Hope this helps,

Rui Barradas

Em 12-07-2013 20:45, Arnaud Michel escreveu: