Learn R Programming

disordR (version 0.0-7)

disord: Functionality for disord objects

Description

Allows arithmetic operators to be used for disord objects; the canonical application is coefficients of multivariate polynomials (as in the mvp package). The issue is that the storage order of disord objects is implementation-specific but the order (whatever it is) must be consistent between the list of keys and values in an associative array.

Usage

is.disord(x)
hash(x)
hashcal(x)
disord(v,h)
consistent(x,y)
x %~% y

Arguments

x,y

Objects of class disord

v

Vector of coefficients

h

Hash code

Value

Boolean, hash code, or object of class disord as appropriate.

Details

The package provides a single S4 class, disord. A detailed vignette is provided that motivates the package.

Function hash() is the extractor function:

`hash` <- function(x){x@hash}

Compare hashcal() which is used to actually calculate the hash code for an object. Currently

`hashcal` <- function(x){digest::sha1(x)}

Examples

Run this code
# NOT RUN {
a <- rdis()
b <- rdis()

a + 2*a + 2^a  # fine
# a + b # error

a[a<0.5] <- 0       # round small entries down


# }

Run the code above in your browser using DataLab