formFuns: test formula: does it contain a particular element?

Description Usage Arguments Value Examples

Description

test formula: does it contain a particular element?

extract terms with a given head from an expression/formula

return a formula/expression with a given value stripped, where it occurs as the head of a term

drop terms matching a particular value from an expression

Usage

1
2
3
4
5
6
7
inForm(form, value)

extractForm(term, value)

dropHead(term, value)

drop.special2(x, value = quote(offset), preserve = NULL)

Arguments

value

term to remove from formula

term

expression/formula

x

formula

preserve

(integer) retain the specified occurrence of "value"

Value

a list of expressions

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
inForm(z~.,quote(.))
inForm(z~y,quote(.))
inForm(z~a+b+c,quote(c))
inForm(z~a+b+(d+e),quote(c))
f <- ~ a + offset(x)
f2 <- z ~ a
inForm(f,quote(offset))
inForm(f2,quote(offset))
extractForm(~a+offset(b),quote(offset))
extractForm(~c,quote(offset))
extractForm(~a+offset(b)+offset(c),quote(offset))
extractForm(~offset(x),quote(offset))
dropHead(~a+offset(b),quote(offset))
dropHead(~a+poly(x+z,3)+offset(b),quote(offset))

glmmTMB documentation built on July 20, 2021, 9:06 a.m.