[R] Asking Favor For "Remove element with Particular Value In Vector"

Jim Lemon jim at bitwrit.com.au
Tue Aug 30 10:47:28 CEST 2011


On 08/30/2011 12:06 AM, Bert Gunter wrote:
> Jim et. al:
>
> This is the second time I've seen this "advice" recently. Use logical
> indexing: which(), though not wrong, is superfluous:
>
>
> x[ !x %in% c(0,255)]  will do, rather than:
>
By golly, you're right, and it works even if x is a logical vector. I 
should have checked the operator precedence.

Jim



More information about the R-help mailing list