find.I.of: Find limits of I() in a String

Description Usage Arguments Value BUGS Note Author(s) References See Also Examples

Description

Returns either NULL or a two-column matrix where each row gives the first and last character of a call to I.

Usage

1
.find.I.of(string, nesting.ok = FALSE)

Arguments

string

a single character string.

nesting.ok

logical value: if TRUE, then all occurrences are given. If FALSE, then calls to I within other calls to it are ignored.

Value

a numeric matrix with two columns, or NULL. Each row represents one call to I.
The first column is the number of the character within the string that starts the call (i.e., the "I").
The second column is the number of the character within the string that ends the call (the ")").

BUGS

Parentheses inside quotes in the call to I will confuse it.

One or more spaces after the "I" will cause the call to be unrecognized. However, if the string is parsed and then deparsed, the space will go away.

Note

This is used by mathgraph functions, and is not meant for direct use.

Author(s)

Nick Efthymiou

References

S Poetry, Patrick J. Burns, Section 11.2, p. 280

See Also

build.mathgraph

Examples

1
2
3
4
5
6
.find.I.of("~ x + I(x^2)")
.find.I.of("~ x + I(x^2 + I(y^3))")
## Not run: 
.find.I.of("~ x + I(x^2 + I(y^3))", TRUE)

## End(Not run)

ClausDethlefsen/mathgraph documentation built on May 25, 2019, 1:36 p.m.