-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

  I haven't yet dug into the internals of match() yet to see what's
going on, but I'm wondering whether there's a design reason why I
can't use %in% (which is a wrapper for match()) on language objects.

I'd like to test whether a language object is in a list of language
objects, but I get the error "'match' requires vector arguments":

specials <- c("foo","bar")
spList <- lapply(specials,as.name)  ## convert to language objects
"a" %in% spList  ## works (FALSE)
spList[[1]] %in% spList ##   'match' requires vector arguments
quote(foo) %in% spList  ## ditto
quote(foo) == spList[[1]]  ## TRUE

obviously I can go the other way, converting my target into text:

deparse(spList[[1]]) %in% specials  ## TRUE

 I could also write my own function to loop through the list and stop
when I find it.  But I'd prefer to use built-in functionality if possible.

  Does anyone have any clues/see what I'm missing?

  cheers
    Ben Bolker
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQEcBAEBAgAGBQJV3JQLAAoJEOCV5YRblxUHTEkIAJluX0F2bLGW1jt1FP2UEZs1
hucBzPGxpHdGE0CAE2Q2rPtKPmJsZdOpkpBPcxorLj4F6C70yY9QmdNlZ1i/spQB
k33EbUsD2XZGcfIVRGSnc1q9QS2vcWRuyC89GRle8xPVD8MfwiV/EMQi4hBk1v9q
TTOug7e1c+I+PtbvrQHpQrCc/1h609I7UqPCOdYbak3xwQC4VNSJ1A8n5w4N+RsV
UVEMkOmhLnwzk6pSSC0dbyOKUluklc5ZYBX8aEM0Cd9bUYhoqc2aXUc7ocsL3f9J
BHlDhy0kfjfwv4wqg/sFKLMIX2IQPxM2zrcd3v1hhEXOYGi7KoHHpZaihbFmEfQ=
=w3OR
-----END PGP SIGNATURE-----

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to