Extract or Replace Data in Objects With Slots
DESCRIPTION:
Extracts the named slot from a S-PLUS object or replaces the contents of the slot with the specified replacement value.
USAGE:
slot
(
object
,
name
)
REQUIRED ARGUMENTS:
- object
-
a S-PLUS object containing slots.
- name
-
a S-PLUS expression evaluating to the name of a slot for the class of object.
VALUE:
The contents of the specified slot.
SEE ALSO:
,
,
,
.
EXAMPLES:
setClass("myclass", representation(x = "numeric", y = "numeric"))
myobj <- new("myclass", c(1, 2))
slot(myobj, "y") # returns 2
slot(myobj, "y") <- 3
slot(myobj, "y") # returns 3