Indeed. Also, Tuple(x) turns a vector into one, I miseed that part of the question. (Although it seems unlikely that a tuple is going to be the best choice here, but we’d have to know more.)

Thank you for your replies. I should clarify that I would like s_target or x to not include the value of p_target.

For those interested in the reason, I am trying to model by-catch, which I define as + and - a certain amount from the body size of the primary target (p_target). A different fishing ratio will be applied to s_target, so I cannot have the body weight of p_target included in s_target.

Could you please explain what the function of - is in test .- p_target or t-p_target? To me it looks like every element of test is subtracted by p_target, and if the result is less than 0.1, it is recorded. Is this correct? Sorry, my brain feels fuzzy at the moment.

Sure. If you print test .- p_target it has a zero in the 6th place, and small values nearby. If you print abs.(test .- p_target) .< 0.1 alone, it is mostly 0 (false) with some true near to the 6th. You could equally well use 0 .< abs.(test .- p_target) .< 0.1 if you want to exclude values precisely equal to p_target.

For the ones with filter, you can try replacing that with map, and will similarly get a vector of true/false, according to what the function t -> ... returns.

Sorry again. I realize I need the index number, like the 5 in test[5], not the value of what test[5] is. But I am glad for all the different ways everyone has shown - they will be handy to learn.