Learn R Programming

BrailleR (version 1.0.2)

grep.VIgraph: String manipulation of the output produced by VI.ggplot

Description

Allows the output from VI.ggplot to be searched and replaced based on a search pattern.

Usage

# S3 method for VIgraph
grep(pattern, x, ...)
# S3 method for VIgraph
gsub(pattern, replacement, x, ...)

Value

Returns a new object of the same type as that returned by VI.ggplot, but with the text component restricted to only those lines that matched the pattern or with the text component replaced.

Arguments

pattern

Regular expression for matching, as per grep

replacement

Replacement text, as per gsub

x

object returned by VI.ggplot

...

other arguments passed on to grep or gsub to control matching behaviour

Author

Debra Warren and Paul Murrell

Details

The BrailleR package redefines the grep and gsub functions as generic functions (that dispatch on the x argument), with base::grep and base::gsub as the default methods. This grep.VIgraph method behaves like base::grep with value=TRUE (i.e., it returns the matched values, not the indices).

Examples

Run this code
if (require(ggplot2)) {
    grep("axis", VI(qplot(1,1)))
    gsub("labels", "tick labels", VI(qplot(1,1)))
}

Run the code above in your browser using DataLab