append.rhs.formula {statnet.common} | R Documentation |
append.rhs.formula
appends a list of terms to the RHS of a
formula. If the formula is one-sided, the RHS becomes the LHS, if
keep.onesided==FALSE
(the default).
append.rhs.formula(object, newterms, keep.onesided = FALSE) nonsimp.update.formula(object, new, ..., from.new = FALSE) term.list.formula(rhs, sign = +1)
object |
formula object to be updated |
newterms |
list of terms (names) to append to the formula, or a formula whose RHS terms will be used |
keep.onesided |
if the initial formula is one-sided, keep it whether to keep it one-sided or whether to make the initial formula the new LHS |
new |
new formula to be used in updating |
... |
Additional arguments. Currently unused. |
from.new |
logical or character vector of variable names. controls how environment of formula gets updated. |
rhs |
a formula-style call containing the right hand side of formula,
obtained by |
sign |
an internal parameter used by |
append.rhs.formula
each return an
updated formula object
nonsimp.update.formula
each return an
updated formula object
terms.list.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
.
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
sub-environment of object, containing, in addition, variables in new listed
in from.new (if a character vector) or all of new (if TRUE).
term.list.formula
: term.list.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.
## 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,list(as.name("z")))) (f4 <- append.rhs.formula(~y,list(as.name("z")),TRUE)) (f5 <- append.rhs.formula(y~x,~z1+z2))