But that is a good reason to always use parentheses: x[ !(x %in% c(0,255))]
since some of the 'precendences' vary between languages. On Tue, Aug 30, 2011 at 4:47 AM, Jim Lemon <j...@bitwrit.com.au> wrote: > 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 > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Jim Holtman Data Munger Guru What is the problem that you are trying to solve? ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.