WISH:

I'd like make a plea for utils:::findMatches() to be exported such
that anyone can do:

.DollarNames.MyClass <- function(x, pattern="") {
   utils:::findMatches(pattern, names(x))
}

The utils:::findMatches() is agile to the "fuzzy" options, cf.
.DollarNames.  It also doesn't erase what's been typed if there is not
match (see below).


ALTERNATIVE:
I'm aware of that utils:::.DollarNames.default almost do the same
thing, but, unfortunately, that does not work for all data type, e.g.
environment-based objects.  An alternative to utils:::findMatches() is
to use:

.DollarNames.MyClass <- function(x, pattern="") {
   grep(pattern, names(x), value=TRUE)
}

but that has the additional downside to return an empty string "" if
there's no match, which in turn erases whatever the user typed before
hitting TAB.


Thanks

Henrik

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

Reply via email to