[R] A %nin% operator?

baptiste Auguié baptiste.auguie at googlemail.com
Thu Aug 5 17:50:21 CEST 2010


For curiosity's sake, and perhaps closer in keystrokes  to R home, here's another version,

`%ni%` <- Negate(`%in%`)

baptiste

On Aug 5, 2010, at 5:30 PM, Ken Williams wrote:

> Ha!  Thanks.  I should have a closer look at Hmisc in general.
> 
> -Ken
> 
> 
> On 8/5/10 10:25 AM, "David Huffer" <David.Huffer at csosa.gov> wrote:
> 
>> See Harrell's Hmisc package
>> 
>> -----Original Message-----
>> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
>> On Behalf Of Ken Williams
>> Sent: Thursday, August 05, 2010 11:20 AM
>> To: r-help at r-project.org
>> Subject: [R] A %nin% operator?
>> 
>> [...]
>> So I write a %nin% operator which I define as:
>> 
>>> `%nin%` <- function (x, table) match(x, table, nomatch = 0L) == 0L
> 
> -- 
> Ken Williams
> Sr. Research Scientist
> Thomson Reuters
> Phone: 651-848-7712
> ken.williams at thomsonreuters.com
> 
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list