Atte Tenkanen
2012-Dec-17 20:24 UTC
[R] 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/
Atte Tenkanen
2012-Dec-17 20:30 UTC
[R] How to test whether is.element() returns only TRUE's
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/
Sarah Goslee
2012-Dec-17 20:38 UTC
[R] How to test whether is.element() returns only TRUE's
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
Bert Gunter
2012-Dec-17 20:39 UTC
[R] How to test whether is.element() returns only TRUE's
?all On Mon, Dec 17, 2012 at 12:24 PM, Atte Tenkanen <attenka@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, > > Atte Tenkanen, FT, MuM > http://users.utu.fi/attenka/ > ______________________________________________ > R-help@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. >-- Bert Gunter Genentech Nonclinical Biostatistics Internal Contact Info: Phone: 467-7374 Website: http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm [[alternative HTML version deleted]]