grepls: Search for objects in the environment

greplsR Documentation

Search for objects in the environment

Description

Search for objects in the environment

Usage

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.

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").

Value

vector of matching object names, or if where="all" a named list, whose names indicate the search environment name, and whose entries are matching object names within each environment.

See Also

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

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)


jmw86069/jamba documentation built on June 12, 2024, 10:28 a.m.