Skip to content
Back to formatted view

Raw Message

Message-ID: <7953BA1D7779E746994B38A00362416C1667A868@exch-mbx-02.utu.fi>
Date: 2012-12-17T20:30:36Z
From: Atte Tenkanen
Subject: How to test whether is.element() returns only TRUE's
In-Reply-To: <7953BA1D7779E746994B38A00362416C1667A853@exch-mbx-02.utu.fi>

I found one:

sum(is.element(c(1,4,2),c(1,2,3)))==length(c(1,4,2))

Are there others and perhaps more elegant ways?

Atte Tenkanen, FT, MuM
http://users.utu.fi/attenka/
________________________________________
L?hett?j?: Atte Tenkanen
L?hetetty: 17. joulukuuta 2012 22:24
Vastaanottaja: r-help at r-project.org
Aihe: How to test whether is.element() returns only TRUE's

Hi,

How can I test, whether all the values that is.element() -function returns are TRUE's

Eg.
> (is.element(c(1,4,2),c(1,2,3)))
[1]  TRUE FALSE  TRUE

This doesn't work:

> (is.element(c(1,4,2),c(1,2,3)))==TRUE
[1]  TRUE FALSE  TRUE

Best,

Atte Tenkanen, FT, MuM
http://users.utu.fi/attenka/