I'm using while within a for loop

```
r0 <- 2.5
f <- seq(from = 1, to = 0, by = -0.001)
fes_eq <- numeric(length(f))
n <- length(f)
for (i in 1:n)
{
fes_eq[i] <- 1-f-exp(-r0*f[i])
while (fes_eq[i] < 0)
{
print(f[i])
i <- i+1
}
}
```

r outputs all values of f and presents the warning "Error in while (fes_eq[i] < 0) { : missing value where TRUE/FALSE needed" at the end

i am trying to get all values of f that gives negative values of fes_eq and I expect to see the smallest f to be around 0.892.

what goes wrong here? what should I do to fix it?