Re: [R] %in% in R?

About this list Date view Thread view Subject view Author view Attachment view

From: Peter Malewski (malewski.peter@mh-hannover.de)
Date: Tue 11 Jun 2002 - 00:33:11 EST


Message-id: <20020610163258.A8359@rzsrv2.rz.tu-bs.de>

On Mon, Jun 10, 2002 at 04:02:29PM +0200, Peter Dalgaard BSA wrote:
> What does it do in Hmisc?

almost the same as in "base":

> get("%in%")
function (x, table)
match(x, table, nomatch = 0) > 0
> library(Hmisc)
*** output flushed ***
> get("%in%")
function (a, b)
{
    if (is.factor(a) & is.numeric(b)) {
        warning("a is factor, b is numeric. Assuming b is coded factor values")
        a <- oldUnclass(a)
    }
    else if (is.numeric(a) && is.factor(b)) {
        warning("a is numeric, b is factor. Assuming a is coded factor values")
        b <- oldUnclass(b)
    }
    match(a, b, nomatch = 0) > 0
}
> oldUnclass
.Primitive("unclass")

PM
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Wed 16 Oct 2002 - 11:57:20 EST