grep.VIgraph {BrailleR}R Documentation

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 class 'VIgraph'
grep(pattern, x, ...)
## S3 method for class 'VIgraph'
gsub(pattern, replacement, x, ...)

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

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

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.

Author(s)

Debra Warren and Paul Murrell

Examples

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

[Package BrailleR version 1.0.2 Index]