> mylist = c(1,2,3)
> if (any(mylist == 3)) { print(3) }
[1] 3
>


On 08/16/2010 03:06 PM, Hyunchul Kim wrote:
Hi all,

How to convert following simple python script to R


if x in a_list:
     print x

OR

simply, how to test if a vector contain a value?


Thank you in advance,

Hyunchul

        [[alternative HTML version deleted]]

______________________________________________
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.


______________________________________________
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.

Reply via email to