misc: Miscellaneous functions

miscR 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 a frab object, but is useful here because it returns a disind when given a Boolean disord object. This is useful for idiom such as x[x>0]

  • Functions is.na() and is.notna() return a disind object

Usage

## S4 method for signature 'frab'
length(x)

Arguments

x

Object of class frab

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

extract

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

frab documentation built on Sept. 12, 2024, 7:36 a.m.