constant: Check if formula contains constant

View source: R/tools.R

constantR Documentation

Check if formula contains constant

Description

Check if formula contains constant

Usage

constant(x)

Arguments

x

formula

Details

Primitive function to check a formula for a constant part. Function checks first and last term on rhs for constant variables at front and back position.

Examples

## Not run: 
constant(y ~ x + a * z) # x
constant(y ~ x * b + 1) # 1
constant(y  ~ 0 + x) # NULL
constant(y  ~ x) # x
constant(y ~ x1 * b1 + b0 + x2 * b2) # wont find b0
constant( y  ~ (x*b +k) + a*y + b*z ) # wont find k
constant( y  ~ (k+ x*b) + a*y + b*z ) # k
constant( y  ~  a*y + b*z + (k + x*b) ) # wont find k
constant( y  ~  a*y + b*z + (x*b + k) ) # k

## End(Not run)

JanMarvin/nlsur documentation built on June 24, 2024, 2:58 a.m.