| str2formula {cwhstring} | R Documentation |
str2formula is the inverse function to formula2string.
term.names2formula combines two vectors of strings into a formula.
str2formula(s) term.names2formula(ls,rs)
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. |
A formula.
Christian W. Hoffmann, christian.hoffmann@wsl.ch, http://www.wsl.ch/staff/christian.hoffmann
The inverse function to str2formula is formula2string.
The inverse functions to term.names2formula are
formula2term.names and formula2Rterm.names.
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