str2formula {cwhmisc} | R Documentation |
str2formula
is the inverse function to formula2string
.
term.names2formula
combines two vectors of strings into a formula.
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.
str2formula(s) term.names2formula(ls,rs) formula2string(form) formula2term.names(form,side) formula2Rterm.names(form)
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. |
form |
a formula. |
side |
one of "left","right". |
str2formula
: A formula.
formula2string
: Character vector containing the string
representation of the formulas side(s).
The inverse function to str2formula
is formula2string
.
The inverse functions to term.names2formula
are
formula2term.names
and formula2Rterm.names
.
Functions use strsplit
Christian W. Hoffmann <c-w.hoffmann@sunrise.ch>
http://www.wsl.ch/personal_homepages/hoffmann/index_EN
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 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"