Given the following data frame:
a <- data.frame(
X1=c("a","a","a","a","a","a","a","a","a","a","a","b","b","b","b","b","b","b","b","b"),
X2=c(2,4,6,2,4,7,9,5,4,7,3,5,8,4,3,5,7,6,3,5),
X3=c(5,6,1,4,7,5,5,4,4,2,5,4,5,2,4,7,3,5,3,7)
)
How to delete any row that is smaller in variable 2 and variable 3 than another row, where two rows have the same coefficient (variable 1)?
eg.
a[1,1]==a[2,1] and
a[1,2]<a[2,2] and
a[1,3]<a[2,3] then a[1,] should be removed.
a <- data.frame( X1=c("a","a","a","a","b","b","b","b"),
X2=c(4,4,7,9,8,5,6,5),
X3=c(6,7,5,5,5,7,5,7) )