I have been reading up about the difference between & and && in R.
I understand that, unlike in other languages where & is for bitwise operations and && is used for conditions like height > 150 && height < 180, in R, both are for the latter. For bitwise, there are other functions such as bitwAnd(a, b)
However, what's the difference between & and &&. From what I've read, all I have understood is that "The longer form(&& I guess) is appropriate for programming control-flow and typically preferred in if clauses"
However, I was trying out something where one seems to work and the other doesn't?
> which( (df$Cost > 14789) & (df$Cost < 14791) )
[1] 29989 69576 116578 137242 160072
> which( (df$Cost > 14789) && (df$Cost < 14791) )
integer(0)