[R] How to test whether is.element() returns only TRUE's

Sarah Goslee sarah.goslee at gmail.com
Mon Dec 17 21:38:26 CET 2012


With all().

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

Sarah

On Mon, Dec 17, 2012 at 3:24 PM, Atte Tenkanen <attenka at utu.fi> wrote:
> 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,
>


--
Sarah Goslee
http://www.functionaldiversity.org




More information about the R-help mailing list