-1

(for example under 1, so in this case I would like to find out which is the max value under 1. I know I should use the max() and add the condition x<1, but I don't know how to write it.

  • Please share some dummy that mimics your real problem. Look at [How to make a great R reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) – markus Sep 16 '20 at 14:39
  • max(data[data<1]) – Waldi Sep 16 '20 at 14:44

1 Answers1

0

You could do it like this:

data <- matrix(c(0.1,1,2,0.9,4),nrow = 5,ncol = 1)
answer <- max(data[data < 1,])
Max
  • 15
  • 5