formula2string {cwhstring}R Documentation

Extract sides of a formula to strings

Description

formula2string Returns the left and the right hand sides of a formula.

formula2term.names Returns one chosen side of a formula.

formula2Rterm.names Returns the right hand side of a formula.

Usage

formula2string(form)
formula2term.names(form,side)
formula2Rterm.names(form)

Arguments

form a formula.
side one of "left","right".

Value

formula2string: Character vector containing the string representation of the formulas side(s).

Note

uses strsplit

Author(s)

Christian W. Hoffmann, christian.hoffmann@wsl.ch, http://www.wsl.ch/staff/christian.hoffmann

See Also

The inverse function to formula2string is str2formula.

Examples

formula2string(a ~ b + c)  #  $left: "a"   $right: "b+c"
formula2string(~ b + c)    #  $left: ""    $right: "b+c"
formula2string(a ~ .)      #  $left: "a"   $right: "."
formula2term.names(a ~ b1 + c,"left")  #   "a"
formula2Rterm.names(a ~ b1 + c)        #   "b1" "c"

[Package cwhstring version 1.0.0 Index]