Compare function

Comparison methods

Comparison methods

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 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 list("spray") package. If any value is NA, equality checks will return FALSE. Functions frab_eq() and c_frab_eq() are just wrappers for the

routine equal(). methods

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

Author(s)

Robin K. S. Hankin

Returns

Generally, return a frab or a logical

See Also

Arith

Examples

rfrab() a <- rfrab(26,sym=letters) a[a<4] <- 100
  • Maintainer: Robin K. S. Hankin
  • License: GPL (>= 2)
  • Last published: 2024-07-24