attrData-class: Class "attrData"

Description Objects from the Class Slots Methods Author(s) Examples

Description

A container class to manage generic attributes. Supports named attributes with default values with methods for vectorized access.

Objects from the Class

Objects can be created by calls of the form new("attrData", defaults). The defaults argument should be a named list containing the initial attribute names and default values.

Slots

data:

Where custom attribute data is stored

defaults:

A named list of known attribute names and defualt values.

Methods

attrDataItem<-

signature(self = "attrData", x = "character", attr = "character"): ...

attrDataItem

signature(self = "attrData", x = "character", attr = "missing"): ...

attrDataItem

signature(self = "attrData", x = "character", attr = "character"): ...

attrDefaults<-

signature(self = "attrData", attr = "character", value = "ANY"): ...

attrDefaults<-

signature(self = "attrData", attr = "missing", value = "list"): ...

attrDefaults

signature(self = "attrData", attr = "missing"): ...

attrDefaults

signature(self = "attrData", attr = "character"): ...

initialize

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

names

return the names of the stored attributes

names<-

set the names of the stored attributes

removeAttrDataItem

signature(self="attrData", x="character", value="NULL"): Remove the data associated with the key specified by x.

Author(s)

Seth Falcon

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
defaultProps <- list(weight=1, color="blue", friends=c("Bob", "Alice"))
adat <- new("attrData", defaults=defaultProps)

## Get all defaults
attrDefaults(adat)

## Or get only a specific attribute
attrDefaults(adat, attr="color")

## Update default weight
attrDefaults(adat, attr="weight") <- 500

## Add new attribute
attrDefaults(adat, attr="length") <- 0

## Asking for the attributes of an element you haven't customized
## returns the defaults
attrDataItem(adat, x=c("n1", "n2"), attr="length")

## You can customize values
attrDataItem(adat, x=c("n1", "n2"), attr="length") <- 5

## What keys have been customized?
names(adat)

pshannon-bioc/graph documentation built on May 26, 2019, 10:32 a.m.