str2formula {cwhstring}R Documentation

Convert back to a formula

Description

str2formula is the inverse function to formula2string. term.names2formula combines two vectors of strings into a formula.

Usage

  str2formula(s)
  term.names2formula(ls,rs)

Arguments

s A list(left,right) containing the string representation of the left and the right hand side of the formula (one string each).
ls A character vector (usually of length 1) containing the names of the terms on the left hand side of the formula.
rs A character vector containing the names of the terms on the right hand side of the formula.

Value

A formula.

Author(s)

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

See Also

The inverse function to str2formula is formula2string. The inverse functions to term.names2formula are formula2term.names and formula2Rterm.names.

Examples

fo <- a ~ b + c
abc <- formula2string(fo)  #  $left: "a"   $right: "b+c"
str2formula(abc)    # a ~ b + c
term.names2formula(formula2term.names(fo,"left"),c(formula2Rterm.names(fo),"X")) 
 # a ~ b + c + X

[Package cwhstring version 2.0 Index]