\HeaderA{delete.response}{Modify Terms Objects}{delete.response}
\aliasA{drop.terms}{delete.response}{drop.terms}
\aliasA{reformulate}{delete.response}{reformulate}
\aliasA{[.terms}{delete.response}{[.terms}
\keyword{programming}{delete.response}
\begin{Description}\relax
\code{delete.response} returns a \code{terms} object for the same
model but with no response variable.

\code{drop.terms} removes variables from the right-hand side of the
model. There is also a \code{"[.terms"} method to perform the same
function (with \code{keep.response=TRUE}).

\code{reformulate} creates a formula from a character vector.
\end{Description}
\begin{Usage}
\begin{verbatim}
delete.response(termobj)

reformulate(termlabels, response = NULL)

drop.terms(termobj, dropx = NULL, keep.response = FALSE)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{termobj}] A \code{terms} object
\item[\code{termlabels}] character vector giving the right-hand side of a
model formula.  Cannot be zero-length.
\item[\code{response}] character string, symbol or call giving the left-hand side of
a model formula, or \code{NULL}.
\item[\code{dropx}] vector of positions of variables to drop from the
right-hand side of the model.
\item[\code{keep.response}] Keep the response in the resulting object?
\end{ldescription}
\end{Arguments}
\begin{Value}
\code{delete.response} and \code{drop.terms} return a \code{terms}
object.

\code{reformulate} returns a \code{formula}.
\end{Value}
\begin{SeeAlso}\relax
\code{\LinkA{terms}{terms}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
ff <- y ~ z + x + w
tt <- terms(ff)
tt
delete.response(tt)
drop.terms(tt, 2:3, keep.response = TRUE)
tt[-1]
tt[2:3]
reformulate(attr(tt, "term.labels"))

## keep LHS :
reformulate("x*w", ff[[2]])
fS <- surv(ft, case) ~ a + b
reformulate(c("a", "b*f"), fS[[2]])

stopifnot(identical(      ~ var, reformulate("var")),
          identical(~ a + b + c, reformulate(letters[1:3])),
          identical(  y ~ a + b, reformulate(letters[1:2], "y"))
         )
\end{ExampleCode}
\end{Examples}

