The R Project SVN R

Rev

Rev 61567 | Rev 68948 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 61567 Rev 61820
Line 94... Line 94...
94
  legitimate slot names.
94
  legitimate slot names.
95
 
95
 
96
  Note that the \code{"@"} operators for extraction and (since \R 3.0.0)
96
  Note that the \code{"@"} operators for extraction and (since \R 3.0.0)
97
  replacement are primitive and actually reside in the \pkg{base}
97
  replacement are primitive and actually reside in the \pkg{base}
98
  package.
98
  package.
-
 
99
 
-
 
100
  The replacement versions of  \code{"@"} and \code{slot()} differ in
-
 
101
  the computations done to coerce the right side of the assignment to
-
 
102
  the declared class of the slot.  Both verify that the value provided
-
 
103
  is from a subclass of the declared slot class.  The  \code{slot()}
-
 
104
  version will go on to call the coerce method if there is one, in
-
 
105
  effect doing the computation \code{as(value, slotClass, strict =
-
 
106
    FALSE)}. The  \code{"@"} version just verifies the relation,
-
 
107
  leaving any coerce to be done later (e.g., when a relevant method is
-
 
108
  dispatched).
-
 
109
 
-
 
110
  In most uses the result is equivalent, and the  \code{"@"} version
-
 
111
  saves an extra function call, but if empirical evidence shows that a
-
 
112
  conversion is needed, either call \code{as()} before the replacement
-
 
113
  or use the replacement version of \code{slot()}.
99
}
114
}
100
\references{
115
\references{
101
 Chambers, John M. (2008)
116
 Chambers, John M. (2008)
102
 \emph{Software for Data Analysis: Programming with R}
117
 \emph{Software for Data Analysis: Programming with R}
103
  Springer.  (For the R version.)
118
  Springer.  (For the R version.)