misc {frab} | R Documentation |
Miscellaneous functions
Description
This page documents various functions that work for frabs, and I will
add to these from time to time as I add new functions that make sense
for frab objects. To use functions like sin()
and abs()
on frab
object x
, work with values(x)
(which is a
disord
object). However, there are a few functions that are a
little more involved:
length()
returns the length of the data component of the object.which()
returns an error when called with afrab
object, but is useful here because it returns adisind
when given a Booleandisord
object. This is useful for idiom such asx[x>0]
Functions
is.na()
andis.notna()
return adisind
object
Usage
## S4 method for signature 'frab'
length(x)
Arguments
x |
Object of class |
Value
Generally return frabs
Note
Constructions such as !is.na(x)
do not work if x
is a
frab
object: this is because is.na()
returns a
disind
object, not a logical. Use is.notna()
to
identify elements that are not NA
.
Author(s)
Robin K. S. Hankin
See Also
Examples
(a <- frab(c(a=1,b=NA,c=44,x=NA,h=4)))
is.na(a)
(x <- frab(c(x=5,y=2,z=3,a=7,b=6)))
which(x>3)
x[which(x>3)]
x[which(x>3)] <- 4
x
is.na(x) <- x<3
x
x[is.na(x)] <- 100
x
y <- frab(c(a=5,b=NA,c=3,d=NA))
y[is.notna(y)] <- 199
y