frab-class {frab} | R Documentation |
Class “frab”
Description
The formal S4 class for frab objects
Usage
## S4 method for signature 'frab'
namedvector(x)
Arguments
x |
Object of class |
Objects from the Class
Formal class frab has a single slot x
which is a named
numeric vector.
The class has three accessor methods: names()
, values()
,
and namedvector()
.
Author(s)
Robin K. S. Hankin
Examples
new("frab",x=c(a=6,b=4,c=1)) # formal creation method (discouraged)
frab(c(a=4,b=1,c=5)) # use frab() in day-to-day work
frab(c(a=4,b=0,c=5)) # zero entries are discarded
frab(c(a=4,b=3,b=5)) # repeted entries are summed
frab(c(apple=4,orange=3,cherry=5)) # any names are OK
x <- frab(c(d=1,y=3,a=2,b=5,rug=7,c=2))
(y <- rfrab())
x+y # addition works as expected
x + 2*y # arithmetic
x>2 # extraction
x[x>3] <- 99 # replacement
# sum(x) # some summary methods implemented
# max(x)
[Package frab version 0.0-6 Index]