Unlimited learning, half price | 50% off

Last chance! 50% off unlimited learning

Sale ends in


gbutils (version 0.2-1)

objectPad-class: Class "objectPad" objects and methods to store and retrieve information

Description

Objects of class "objectPad" can be used as storage of information. There are methods for storage and retrieval.

Arguments

Objects from the Class

Objects can be created by calls of the form new("objectPad", ...). Currently the ... arguments are ignored and an empty object is created.

Objects of class "objectPad" have no user-level slots. Values are stored and retrieved with the function pad, for the former purpose using it on the left-hand side of an assignment.

Slots

.Data:

Object of class "list", inherited from "list".

Extends

Class "'>list", from data part. Class "'>vector", by class "list", distance 2.

Methods

initialize

signature(.Object = "objectPad"): ...

pad

signature(x = "objectPad", item = "missing"): ...

pad

signature(x = "objectPad", item = "ANY"): ...

pad<-

signature(x = "objectPad"): ...

See Also

pad-methods

Examples

Run this code
# NOT RUN {
# create a pad and store some info.
pa <- new("objectPad")
pad(pa,"apple") <- "fruit"
pad(pa,"sweets") <- "sweets"
# pad(pa,"apple","dentist") <- "keeps away from her/him"
# pad(pa,"sweets","dentist") <- "helps meeting her/him"
pad(pa,"young Gauss") <- 100*(100+1)/2
pad(pa,"layman") <- sum(1:100)

pad(pa,"apple")
pad(pa,"sweets")
# pad(pa,"apple","dentist")
# pad(pa,"sweets","dentist")
pad(pa,"young Gauss") - pad(pa,"layman")

# create a class of vectors with a pad
setClass("vecWithPad",representation(x="numeric",pad="objectPad"))
a <- new("vecWithPad",x=1:10)
pad(a,"mean") <- mean(a@x)    # Compute and store the mean, and
pad(a,"mean")                 # retrieve it
# }

Run the code above in your browser using DataLab