Displaying 3 results from an estimated 3 matches for "nosuchsymbol".
2015 Aug 25
2
match()/%in% with language objects?
-----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'
2015 Aug 26
1
match()/%in% with language objects?
...or slightly more naturally for the first case,
> expression(1+2, log2(16)) %in% expression(3, 1+2, c(4L,5L,6L,7L))
[1] TRUE FALSE
> With your example data:
> spList[1] %in% spList
> #[1] TRUE
> list(quote(foo)) %in% spList
> #[1] TRUE
> list(quote(nosuchsymbol)) %in% spList
> #[1] FALSE
yes indeed, that works because list()s and expression()s are
"vector"s in the wide sense, as "we all" know.
Did you support Ben's wish to allow 'symbol' (aka 'name') objects as well,
or even more general language objects...
2015 Aug 25
0
match()/%in% with language objects?
...quote(1+2), quote(log2(16))) %in% list(3, quote(1+2), c(4L,5L,6L,7L))
#[1] TRUE FALSE
match(list(quote(1+2), quote(log2(16))), list(3, quote(1+2),
c(4L,5L,6L,7L)))
#[1] 2 NA
With your example data:
spList[1] %in% spList
#[1] TRUE
list(quote(foo)) %in% spList
#[1] TRUE
list(quote(nosuchsymbol)) %in% spList
#[1] FALSE
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Tue, Aug 25, 2015 at 9:12 AM, Ben Bolker <bbolker at gmail.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
> I haven't yet dug into the internals of match() yet to see what...