\HeaderA{attrassign}{Create new-style "assign" attribute}{attrassign}
\methaliasA{attrassign.default}{attrassign}{attrassign.default}
\methaliasA{attrassign.lm}{attrassign}{attrassign.lm}
\keyword{models}{attrassign}
\begin{Description}\relax
The \code{"assign"} attribute on model matrices describes which columns
come from which terms in the model formula. It has two version. R uses
the original version, but the newer version is sometimes useful.
\end{Description}
\begin{Usage}
\begin{verbatim}
## Default S3 method:
attrassign(object, tt,...)
## S3 method for class 'lm':
attrassign(object,...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{object}] model matrix or linear model object
\item[\code{tt}] terms object
\item[\code{...}] ignored
\end{ldescription}
\end{Arguments}
\begin{Value}
A list with names corresponding to the term names and elements
that are vectors indicating which columns come from which terms
\end{Value}
\begin{SeeAlso}\relax
\code{\LinkA{terms}{terms}},\code{\LinkA{model.matrix}{model.matrix}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
formula<-Surv(time,status)~factor(edtrt)
tt<-terms(formula)
mf<-model.frame(tt,data=pbc)
mm<-model.matrix(tt,mf)
## a few rows of data
mm[1:3,]
## old-style assign attribute
attr(mm,"assign")
## new-style assign attribute
attrassign(mm,tt)
\end{ExampleCode}
\end{Examples}

