imget | R Documentation |
Case-insensitive mget()
imget( x, envir = as.environment(-1L), mode = "any", ifnotfound = NA, inherits = FALSE, verbose = FALSE, ... )
x |
character vector of object names. |
envir, mode, ifnotfound, inherits |
arguments are passed to
|
This function is a lightweight wrapper around base::mget()
(and generics) that intends to allow case-insensitive matching.
It does so by converting all keys to lowercase, matching
lowercase input to these lowercase keys, then using the original
keys in native base::mget()
.
One small change from base::mget()
is the default
argument ifnotfound=NA
.
This function secretly runs mget()
using the unique lowercase
input values x
, to reduce the number of queries. This implementation
is designed to help with extremely long and potentially highly duplicated
input values in x
, in which case the change greatly reduces the time
to return results.
Note: This function returns the first matching lowercase key, with the direct assumption that keys will not be duplicated after converting to lowercase. Should this assumption become a problem, please provide feedback and we will change the method accordingly.
Note: For unknown reasons, the R method dispatch was not
behaving properly for objects of class "AnnDbBimap"
, presumably
because the generic functions AnnotationDbi::ls()
and
AnnotationDbi::mget()
were written for class "Bimap"
.
So when the input envir
class contains "Bimap"
the
direct function AnnotationDbi::keys()
is called, and if it
fails for some reason, AnnotationDbi::ls()
is called,
thes AnnotationDbi::mget()
is called, otherwise the generic
ls()
or mget()
is called.
named list
of objects found, or NA
for objects
that are not found.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.