Compare-methods {frab}R Documentation

Comparison methods

Description

Methods for comparison (greater than, etc) in the frab package.

Frabs and sparsetables may be compared with length-one numeric vectors. Functions frab_gt_num() etc follow a consistent naming convention; the mnemonic is the old Fortran .GT. scheme [for “greater than”]. This allows one to use idiom such as f >= 3. For sparsetables, comparison with scalars is possible: but the result is flattened to a disord object (this can be confusing for two dimensional tables when the default matrix-like print method is used, because zero entries are not “real”. For example, if s is a sparsetable, then s==0 will return all FALSE).

Comparing a frab with another frab is generally meaningless. Idiom like “e1 >= e2”, for example, returns an error. The only comparison that makes any sense is whether two frabs are identical: this is detected by “e1 == e2” and its negation “e1 != e2”. Internally, equality is tested in C using a routine written for speed (specifically, returning FALSE as soon as it spots a difference between its two arguments); this is modelled on its equivalent in the spray package. If any value is NA, equality checks will return FALSE. Functions frab_eq() and c_frab_eq() are just R wrappers for the C routine equal().

Usage

frab_eq(e1,e2)
frab_eq_num(e1,e2)
frab_ne_num(e1,e2)
frab_gt_num(e1,e2)
frab_ge_num(e1,e2)
frab_lt_num(e1,e2)
frab_le_num(e1,e2)
num_eq_frab(e1,e2)
num_ne_frab(e1,e2)
num_gt_frab(e1,e2)
num_ge_frab(e1,e2)
num_lt_frab(e1,e2)
num_le_frab(e1,e2)
numeric_compare_frab(e1,e2)
frab_compare_frab(e1,e2)
frab_compare_numeric(e1,e2)

Arguments

e1, e2

Objects of class frab

Value

Generally, return a frab or a logical

Author(s)

Robin K. S. Hankin

See Also

Arith

Examples

rfrab()
a <- rfrab(26,sym=letters)
a[a<4] <- 100

[Package frab version 0.0-6 Index]