Here is an example:
set.seed(123)
data<-data.frame(X=rep(letters[1:3], each=4),Y=sample(1:12,12),Z=sample(1:100, 12))
data[data==3]<-NA
What I am to realize is to select the unique row of X
with minimum Y
by ignoring NA
s:
a 4 68
b 1 4
c 2 64
What's the best way to do that?