Skip to content
Prev 334196 / 398502 Next

data frame question

Hi Andras,

here is an other solution which also works if b contains missing values:

a <-seq(0,10,by=1)
b <-c(NA, 11:20)
f <-16
#
a[which.max(b[b<f])]
#

However, your question seems a bit artificial. Maybe you converted your
original question to a suboptimal problem.

HTH,
  Denes