Description Usage Arguments Value Functions Examples
Functions for Querying, Validating and Extracting from Formulas
A suite of utilities for handling model formulas of the style used in Statnet packages.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17  append_rhs.formula(object, newterms, keep.onesided = FALSE)
append.rhs.formula(object, newterms, keep.onesided = FALSE)
filter_rhs.formula(object, f, ...)
nonsimp_update.formula(object, new, ..., from.new = FALSE)
nonsimp.update.formula(object, new, ..., from.new = FALSE)
term.list.formula(rhs, sign = +1)
list_summands.call(object)
list_rhs.formula(object)
eval_lhs.formula(object)

object 
formula object to be updated or evaluated 
newterms 
list of terms (names) to append to the formula, or
a formula whose RHS terms will be used; either may have a "sign"
attribute vector of the same length as the list, giving the sign
of each term ( 
keep.onesided 
if the initial formula is onesided, keep it whether to keep it onesided or whether to make the initial formula the new LHS 
f 
a function whose first argument is the term and whose
additional arguments are forwarded from 
... 
Additional arguments. Currently unused. 
new 
new formula to be used in updating 
from.new 
logical or character vector of variable names. controls how environment of formula gets updated. 
rhs, sign 
Arguments to the deprecated 
append_rhs.formula
each return an updated formula
object
nonsimp_update.formula
each return an
updated formula object
list_summands.call
returns a list of unevaluated calls, with an additional numerical vector attribute "sign"
with of the same length, giving the corresponding term's sign as +1
or 1
.
list_rhs.formula
returns a list of formula terms, with an additional numerical vector attribute "sign"
with of the same length, giving the corresponding term's sign as +1
or 1
.
eval_lhs.formula
an object of whatever type the LHS evaluates to.
append_rhs.formula
: append_rhs.formula
appends a list of terms to the RHS of a
formula. If the formula is onesided, the RHS becomes the LHS, if
keep.onesided==FALSE
(the default).
append.rhs.formula
: append.rhs.formula
has been renamed to append_rhs.formula
.
filter_rhs.formula
: filter_rhs.formula
filters through the terms in the RHS of a
formula, returning a formula without the terms for which function
f(term, ...)
is FALSE
. Terms inside another term (e.g.,
parentheses or an operator other than + or ) will be unaffected.
nonsimp_update.formula
: nonsimp_update.formula
is a reimplementation of
update.formula
that does not simplify. Note that the
resulting formula's environment is set as follows. If
from.new==FALSE
, it is set to that of object. Otherwise, a new
subenvironment of object, containing, in addition, variables in new listed
in from.new (if a character vector) or all of new (if TRUE).
nonsimp.update.formula
: nonsimp.update.formula
has been renamed to nonsimp_update.formula
.
term.list.formula
: term.list.formula
is an older version of list_rhs.formula
that required the RHS call, rather than the formula itself.
list_summands.call
: list_summands.call
, given an unevaluated call or expression
containing the sum of one or more terms, returns a list of the
terms being summed, handling +
and 
operators and
parentheses, and keeping track of whether a term has a plus or a
minus sign.
list_rhs.formula
: list_rhs.formula
returns a list containing terms in a given
formula, handling +
and 
operators and parentheses, and
keeping track of whether a term has a plus or a minus sign.
eval_lhs.formula
: eval_lhs.formula
extracts the LHS of a formula, evaluates it in the formula's environment, and returns the result.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28  ## append_rhs.formula
(f1 < append_rhs.formula(y~x,list(as.name("z1"),as.name("z2"))))
(f2 < append_rhs.formula(~y,list(as.name("z"))))
(f3 < append_rhs.formula(~y+x,structure(list(as.name("z")),sign=1)))
(f4 < append_rhs.formula(~y,list(as.name("z")),TRUE))
(f5 < append_rhs.formula(y~x,~z1z2))
## filter_rhs.formula
(f1 < filter_rhs.formula(~ab+c, `!=`, "a"))
(f2 < filter_rhs.formula(~a+bc, `!=`, "a"))
(f3 < filter_rhs.formula(~ab+c, `!=`, "b"))
(f4 < filter_rhs.formula(~a+bc, `!=`, "b"))
(f5 < filter_rhs.formula(~ab+c, `!=`, "c"))
(f6 < filter_rhs.formula(~a+bc, `!=`, "c"))
(f7 < filter_rhs.formula(~ca+bc(a),
function(x) (if(is.call(x)) x[[1]] else x)!="c"))
## eval_lhs.formula
(result < eval_lhs.formula((2+2)~1))
stopifnot(identical(result,4))

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.