Search for objects in the environment
Arguments
- x
- characterstring used as a grep pattern
- where
- characterstring compatible with- base::ls()or if installed,- AnnotationDbi::ls(). A special value- "all"will search all environments on the search path- base::search()in order.
- ignore.case
- logicalindicating whether the pattern match is case-insensitive.
- searchNames
- logicalindicating whether names should also be searched, which is only relevant for- AnnDbobjects, for example- org.Mm.egSYMBOL2EGfrom the- org.Mm.eg.dbBioconductor package.
- verbose
- logicalindicating whether to print verbose output.
- ...
- additional parameters are ignored. 
Value
character vector of matching object names, or if
where="all" it returns a named list
whose names indicate the search environment name, and whose
entries are matching object names within each environment.
Details
This function searches the active R environment for an object name
using vigrep() (value, case-insensitive grep).
It is helpful when trying to find an object using a
substring, for example grepls("statshits").
Examples
# Find all objects named "grep", which should find
# base grep() and jamba::vigrep() among other results.
grepls("grep");
#> $`package:jamba`
#>  [1] "grepls"    "igrep"     "igrepHas"  "igrepl"    "proigrep"  "provigrep"
#>  [7] "unigrep"   "unvigrep"  "vgrep"     "vigrep"   
#> 
#> $`package:base`
#> [1] "agrep"   "agrepl"  "grep"    "grepRaw" "grepl"  
#> 
# Find objects in the local environment
allStatsHits <- c(1:12);
someStatsHits <- c(1:3);
grepls("statshits");
#> named list()
# shortcut way to search only the .GlobalEnv, the active local environment
grepls("statshits", 1);
#> character(0)
# return objects with "raw" in the name
grepls("raw");
#> $`package:jamba`
#> [1] "drawLabels"
#> 
#> $`package:base`
#>  [1] "all.equal.raw"      "as.data.frame.raw"  "as.raw"            
#>  [4] "charToRaw"          "grepRaw"            "is.raw"            
#>  [7] "raw"                "rawConnection"      "rawConnectionValue"
#> [10] "rawShift"           "rawToBits"          "rawToChar"         
#> 
# Require "Raw" to be case-sensitive
grepls("Raw", ignore.case=FALSE)
#> $`package:jamba`
#> character(0)
#> 
#> $`package:base`
#> [1] "charToRaw" "grepRaw"  
#>