S3Part
S4 Classes that Contain S3 Classes
Description
Accesses an S3 object contained within an S4 object.
Usage
S3Part(object, strictS3 = FALSE, S3Class)
S3Part(object, strictS3 = FALSE, needClass = .S3Class(object)) <- value
Arguments
object |
an object.
|
strictS3 |
a logical value. If TRUE, then when S3Part extracts from an object
extending oldClass, it clears the S4 flag for the returned value
(see isS4).
|
S3Class |
a string vector. If this argument is specified, it is set as the class of
the object returned by S3Part.
|
needClass |
a string vector. If object extends oldClass,
S3Part<- checks if value extends this class.
|
value |
an object, inserted as the S3 object contained in object.
|
Details
An S4 object is considered to contain an S3 object if its class
contains a basic vector class, or a class defined with
setOldClass, or a subclass of these.
| S3Part | extracts the S3 object from such an S4 object. If
object is not an S4 object, it is simply returned. |
| S3Part<- | modifies the S3 object within such an S4 object. If
object is not an S4 object, it just returns value
|
Value
S3Part | returns the S3 object extracted from an S4 object. |
S3Part<- | returns the modified object. |
See Also
setOldClass, isS4.
Examples
setClass("myClass", list(x="character"), contains="integer")
xx <- new("myClass", 123L, x="abc")
S3Part(xx)
## [1] 123
S3Part(xx) <- 456L
xx
## An object of class "myClass"
## [1] 456
## Slot "x":
## [1] "abc"