Learn R Programming

ComplexAnalysis (version 1.0)

object.extract: Extract mathematical functions or variables

Description

The function extract mathematical functions or variables from a string which is usually the body of a function. If one wishes to extract directly from a function, such function must first be converted into a string. Another function in this package body2string does this.

Usage

object.extract(func, variable = TRUE, subset.q = TRUE, exception = NULL)

Arguments

func
A string. Although it is named as "func", this argument must be string-type. Function body2string converts an R function into a string.
variable
If TRUE, only mathematical variables in func will be extracted, otherwise mathematical functions will be extracted.
subset.q
If TRUE, the square bracket (usually used as subsetting) is recognised as part of the attached variable. E.g. x[a:b] will be recognised as one single variable while if FALSE, square brackets are ignored and three variables x,a,b are returned.
exception
String. Mathematical variables or functions not to be extracted. Can be a vector.

Value

A list of string of variables or functions in func.

Details

NULL is returned if no variable or function in func.

See Also

body2string