check ?"%in%", e.g.,

x <- c("foo", "bar", "bar2", "qux")
"foo" %in% x
"GUNDALA" %in% x


I hope it helps.

Best,
Dimitris

---
Dimitris Rizopoulos
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
     http://perswww.kuleuven.be/dimitris_rizopoulos/


Quoting Gundala Viswanath <[EMAIL PROTECTED]>:

Hi all,

Is there a way to do it?
For example:

x
"foo" "bar" "bar2" "qux"

is there a function to return TRUE/FALSE
given a test variable

func("foo")
TRUE

func("GUNDALA")
FALSE

Is there such "func" in R?

- Gundala Viswanath
Jakarta - Indonesia

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





Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm

______________________________________________
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