You can abbreviate list names? Why?
I suspect that partial matching by the $
operator was a nice(r) feature for interactive use back in the days before tabbed completion had been implemented
If you don't like that behavior, you can use the "[["
operator instead. It takes an argument exact=
, which allows you to control partial matching behavior, and which defaults to TRUE
.
wtf[["whatisthep"]] # Only returns exact matches# NULLwtf[["whatisthep", exact=FALSE]] # Returns partial matches without warning# [1] 2wtf[["whatisthep", exact=NA]] # Returns partial matches & warns that it did# [1] 2# Warning message:# In wtf[["whatisthep", exact = NA]] :# partial match of 'whatisthep' to 'whatisthepointofthis'
(This is one reason why "[["
is generally preferred to $
in R programming. Another is the ability to do this X <- "whatisthe"; wtf[[X]]
but not this X <- "whatisthe"; wtf$X
.)