Extract {frab} | R Documentation |
Extraction and replacement methods for class "frab"
Description
The frab
class provides basic arithmetic and extract/replace
methods for frab objects.
Class index is taken from the excellent Matrix package
and is a setClassUnion()
of classes numeric
,
logical
, and character
.
Value
Generally, return a frab
object.
Methods
- [
signature(x = "frab", i = "character", j = "missing")
:x["a"] <- 33
- [
signature(x = "frab", i = "disord", j = "missing")
:x[x>3]
- [
signature(x = "frab", i = "missing", j = "missing")
:x[]
- [<-
signature(x = "frab", i = "character",j = "missing", value = "ANY")
:x["a"] <- 3
- [<-
signature(x = "frab", i = "disord", j = "missing", value="frab")
:x[x<0] <- -x[x<0]
; not implemented- [<-
signature(x = "frab", i = "disord", j = "missing", value="logical")
:x[x<0] <- NA
- [<-
signature(x = "frab", i = "ANY",j = "ANY", value = "ANY")
: not implemented- [<-
signature(x = "frab", i = "disindex",j = "missing", value = "numeric")
:x[x>0] <- 3
- [<-
signature(x = "frab", i = "character", j = "missing", value = "logical")
:x["c"] <- NA
Double square extraction, as in x[[i]]
and x[[i]] <-
value
, is not currently defined. In replacement methods, if
value
is logical it is coerced to numeric (this includes
NA
).
Special dispensation is given for extraction of a frab
with a
length zero index, as in x[NULL]
, which returns the empty
frab
object.
Author(s)
Robin K. S. Hankin
Examples
frab(setNames(seq_len(0),letters[seq_len(0)]))
a <- rfrab(26,sym=letters)
a<4
a[a<4]
a[a<4] <- 100
a
x <- rfrab()
values(x) <- values(x) + 66
x <- rfrabb()
v <- values(x)
v[v<0] <- abs(v[v<0]) + 50
values(x) <- v
names(x) <- toupper(names(x))
x