Learn R Programming

mark (version 0.8.2)

glob: Wildcard globbing

Description

Helper function for globbing character vectors

Usage

glob(x, pattern = NULL, value = TRUE, ...)

Arguments

x

A vector of characters

pattern

Wildcard globbing pattern

value, ...

Additional parameters passed to grep. Note: value is by default TRUE; when NA, ... is passed to grepl.

Examples

Run this code
x <- c("apple", "banana", "peach", "pear", "orange")
glob(x, "*e")
glob(x, "pea*", value = FALSE)
glob(x, "*an*", value = NA)

path <- system.file("R", package = "mark")
glob(list.files(path), "r*")

Run the code above in your browser using DataLab