Message-ID: <79096238-59C9-4D8F-B653-C6FF2AEFAEF1@gmail.com>
Date: 2008-12-11T17:11:25Z
From: David B. Thompson, Ph.D., P.E., D.WRE, CFM
Subject: Logical "in" test
OK, this should be trivial but I'm not finding it. I want to compress
the test,
if (i==7 | i==10 | i==30 | i==50) {}
into something like
if (i in c(7,10,30,50)) {}
so I can build a "excludes" vector
excludes <- c(7,10,30,50)
and test
if (i in excludes) {}
However, I'm not finding a clue on how to accomplish this, if it can
be done. Would someone with more R experience lend a helping hand
please? A reference (so I can continue learning) would also be
appreciated.
Thanks...
-=d
David Thompson, Ph.D., P.E., D.WRE, CFM
Civil Engineer/Hydrologist