Allows the output from VI.ggplot to be searched and replaced based on a search pattern.
# S3 method for VIgraph
grep(pattern, x, …)
# S3 method for VIgraph
gsub(pattern, replacement, x, …)
Regular expression for matching, as per grep
Replacement text, as per gsub
object returned by VI.ggplot
other arguments passed on to grep
or gsub
to control matching behaviour
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.
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).
# NOT RUN {
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