grepls function

Search for objects in the environment

Search for objects in the environment

grepls( x, where = "all", ignore.case = TRUE, searchNames = TRUE, verbose = FALSE, ... )

Arguments

  • x: character string used as a grep pattern

  • where: character string 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: logical indicating whether the pattern match is case-insensitive.

  • searchNames: logical indicating whether names should also be searched, which is only relevant for AnnDb objects, for example org.Mm.egSYMBOL2EG from the org.Mm.eg.db

    Bioconductor package.

  • verbose: logical indicating whether to print verbose output.

  • ...: additional parameters are ignored.

Returns

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"); # Find objects in the local environment allStatsHits <- c(1:12); someStatsHits <- c(1:3); grepls("statshits"); # shortcut way to search only the .GlobalEnv, the active local environment grepls("statshits", 1); # return objects with "raw" in the name grepls("raw"); # Require "Raw" to be case-sensitive grepls("Raw", ignore.case=FALSE)

See Also

Other jam grep functions: igrep(), igrepHas(), igrepl(), provigrep(), unigrep(), unvigrep(), vgrep(), vigrep()

  • Maintainer: James M. Ward
  • License: MIT + file LICENSE
  • Last published: 2025-03-23