I have a data frame like this (5 rows and 1 column),
       data
row1    5
row2    4
row3    12
row4    6
row5    7
I want to make a comparison between current rows and following rows, as this table display.
compare    YES  NO
row1<row2       0
row1<row3   1   
row1<row4   1   
row1<row5   1   
row2<row3   1   
row2<row4   1   
row2<row5   1   
row3<row4       0
row3<row5       0
row4<row5   1   
Another, I've typed some codes in R, with for loop.
    for (i in 1:nrow(data)){
  if (data[i,] <data[(i+1):5,]){
    print("1")
  } else { 
    print ("0")
  } 
}
However, I get error information.missing value where TRUE/FALSE needed
Can anyone help me to solve this problem? Or, maybe the apply function is better?
Sorry for my poor English, and big thanks for your precious time!
 
    