fast way to check an object is a member of a list?
Dear Francisco,
At 01:38 PM 11/19/2002 -0800, Francisco J Molina wrote:
Is there any fast way to check that an object is a member of a list?
Here's a third interpretation of your question, to test whether somewhere is list there is an object identical to y: any(sapply(list, function(x) identical(y, x))) (You could, in addition, test whether there is an element named y in list, as Martin Maechler proposed.) Does that do it? John ----------------------------------------------------- John Fox Department of Sociology McMaster University Hamilton, Ontario, Canada L8S 4M4 email: jfox at mcmaster.ca phone: 905-525-9140x23604 web: www.socsci.mcmaster.ca/jfox ----------------------------------------------------- -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._