| Line 30... |
Line 30... |
| 30 |
\usage{
|
30 |
\usage{
|
| 31 |
as(object, Class, strict=TRUE)
|
31 |
as(object, Class, strict=TRUE)
|
| 32 |
|
32 |
|
| 33 |
as(object, Class) <- value
|
33 |
as(object, Class) <- value
|
| 34 |
|
34 |
|
| 35 |
setAs(from, to, def, replace, where = 1)
|
35 |
setAs(from, to, def, replace, where = topenv(parent.frame()))
|
| 36 |
|
36 |
|
| 37 |
}
|
37 |
}
|
| 38 |
\section{Summary of Functions}{
|
38 |
\section{Summary of Functions}{
|
| 39 |
\describe{
|
39 |
\describe{
|
| 40 |
\item{\code{as}:}{
|
40 |
\item{\code{as}:}{
|
| 41 |
Returns the version of this object coerced to be the given
|
41 |
Returns the version of this object coerced to be the given
|
| 42 |
\code{Class}.
|
42 |
\code{Class}.
|
| 43 |
|
43 |
|
| 44 |
If the corresponding \code{is} relation is true, it will be used.
|
44 |
If the corresponding \code{is} relation is true, it will be used.
|
| 45 |
In particular, if the relation has a coerce method, the method
|
45 |
In particular, if the relation has a coerce method, the method
|
| 46 |
will be invoked on \code{object}.
|
46 |
will be invoked on \code{object}.
|
| 47 |
|
47 |
|
| 48 |
If the \code{is} relation is \code{FALSE}, and \code{coerceFlag}
|
48 |
If the \code{is} relation is \code{FALSE}, and \code{coerceFlag}
|
| Line 106... |
Line 106... |
| 106 |
\code{to}. (If you want to save \code{setAs} a little work, make
|
106 |
\code{to}. (If you want to save \code{setAs} a little work, make
|
| 107 |
the name of the argument \code{from}, but don't worry about it,
|
107 |
the name of the argument \code{from}, but don't worry about it,
|
| 108 |
\code{setAs} will do the conversion.) }
|
108 |
\code{setAs} will do the conversion.) }
|
| 109 |
\item{replace}{If supplied, the function to use as a replacement
|
109 |
\item{replace}{If supplied, the function to use as a replacement
|
| 110 |
method.}
|
110 |
method.}
|
| 111 |
\item{where}{ The position or environment in which to store the resulting method for
|
111 |
\item{where}{the position or environment in which to store the
|
| - |
|
112 |
resulting method for \code{coerce}.}
|
| 112 |
\code{coerce}; by default, the global environment. }
|
113 |
%% FIXME: ; by default, the ... environment.}
|
| 113 |
}
|
114 |
}
|
| 114 |
|
115 |
|
| 115 |
%% <FIXME>
|
116 |
%% <FIXME>
|
| 116 |
%% Currently Rdconv cannot deal with markup in section titles.
|
117 |
%% Currently Rdconv cannot deal with markup in section titles.
|
| 117 |
%% \section{How Functions \code{as} and \code{setAs} Work}{
|
118 |
%% \section{How Functions \code{as} and \code{setAs} Work}{
|
| Line 191... |
Line 192... |
| 191 |
|
192 |
|
| 192 |
%% <FIXME>
|
193 |
%% <FIXME>
|
| 193 |
%% Currently Rdconv cannot deal with markup in section titles.
|
194 |
%% Currently Rdconv cannot deal with markup in section titles.
|
| 194 |
%% \section{The Function \code{as} Used in Replacements}{
|
195 |
%% \section{The Function \code{as} Used in Replacements}{
|
| 195 |
\section{The Function `as' Used in Replacements}{
|
196 |
\section{The Function `as' Used in Replacements}{
|
| 196 |
%% </FIXME>
|
197 |
%% </FIXME>
|
| 197 |
When \code{as} appears on the left of an assignment, the intuitive
|
198 |
When \code{as} appears on the left of an assignment, the intuitive
|
| 198 |
meaning is \dQuote{Replace the part of \code{object} that was inherited from
|
199 |
meaning is \dQuote{Replace the part of \code{object} that was inherited from
|
| 199 |
\code{Class} by the \code{value} on the right of the assignment.}
|
200 |
\code{Class} by the \code{value} on the right of the assignment.}
|
| 200 |
|
201 |
|
| 201 |
This usually has a straightforward interpretation, but you can control
|
202 |
This usually has a straightforward interpretation, but you can control
|
| Line 253... |
Line 254... |
| 253 |
While the programming interface for the \pkg{methods} package follows
|
254 |
While the programming interface for the \pkg{methods} package follows
|
| 254 |
the reference, the R software is an original implementation, so
|
255 |
the reference, the R software is an original implementation, so
|
| 255 |
details in the reference that reflect the S4 implementation may appear
|
256 |
details in the reference that reflect the S4 implementation may appear
|
| 256 |
differently in R. Also, there are extensions to the programming
|
257 |
differently in R. Also, there are extensions to the programming
|
| 257 |
interface developed more recently than the reference. For a
|
258 |
interface developed more recently than the reference. For a
|
| 258 |
discussion of details and ongoing development, see the web page
|
259 |
discussion of details and ongoing development, see the web page
|
| 259 |
\url{http://developer.r-project.org/methodsPackage.html} and the
|
260 |
\url{http://developer.r-project.org/methodsPackage.html} and the
|
| 260 |
pointers from that page.
|
261 |
pointers from that page.
|
| 261 |
}
|
262 |
}
|
| 262 |
\examples{
|
263 |
\examples{
|
| 263 |
## using the definition of class "track" from \link{Classes}
|
264 |
## using the definition of class "track" from \link{Classes}
|