I am running a for-loop to wrap a function across a large dataset. It's a fisheries function that performs an equation on a vector "ll". Vector ll is the crux of the for-loop, with a lot of wrangling being done to create ll for each iteration. I have included the important part of the loop here.
mod<-removal(ll, method = "Burnham", Tmult = 5)
However, for the equation to work, the numbers in the vector need to be descending. If they are not, the function will run, but will fill the results (model stats) with NA's. For analysis purposes, the result if this happens should simply be 1.5*sum(ll). I would like to build a wrapper statement into this loop, that essentially says "if this warning should occur, then multiply sum(ll) by 1.5" but I can't figure out how to build that conditional in R. Any help is appreciated!