[R] Partial matching with $ extractor.
Rolf Turner
r@turner @end|ng |rom @uck|@nd@@c@nz
Tue Jan 24 22:57:16 CET 2023
Has something changed, but I missed it?
My recollection is that $ extraction used partial matching.
E.g. if one did
junk <- list(yuck=1,yurk=2,y=3)
junk$y
then one would get 1 as the result; probably *not* the desired result.
See fortunes::fortune("toad").
To get the desired result, one would need to use junk[["y"]].
Likewise junk$yu would give 1; to get the value of "yurk", one would
need to use junk$yur or junk$yurk or (better?) junk[["yurk"]].
However, either my recollection is wrong, or something has changed.
When I do junk$y I get 3 (the "right" answer; the same as junk[["y"]]).
When I do junk$yu I get NULL (just as if I'd done junk[["yu"]]).
So: has something changed, or am I miss-remembering, or am I completely
confused about the whole issue?
Thanks for any enlightenment.
cheers,
Rolf Turner
--
Honorary Research Fellow
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276
More information about the R-help
mailing list