R: Methods for Version Management in Package 'distr'

Version Management {distr} | R Documentation

## Methods for Version Management in Package ‘distr’

### Description

Version-Management-methods

### Usage

    isOldVersion(object)
    conv2NewVersion(object)
    ## S4 method for signature 'ANY'
    isOldVersion(object)
    ## S4 method for signature 'ANY'
    conv2NewVersion(object)
    ## S4 method for signature 'LatticeDistribution'
    conv2NewVersion(object)

### Arguments

`object` | object of class `"ANY"` (or subclasses)

### Details

From version 1.9 of this package on, class `"AbscontDistribution"` has an extra slot `gaps`. As the addition of new slots will probably happen again in the future development of our packages, we provide the following two help functions `isOldVersion` and `conv2NewVersion` to check whether the object was generated by an older version of this package and to convert such an object to the new format, respectively. Also, the intermediate class `"LatticeDistribution"` is introduced at version 1.9 so that all subclasses of `"DiscreteDistribution"` like `"Binom"`, `"Nbinom"` etc, now have an extra slot `lattice`. `conv2NewVersion` takes this up and provides a particular method for signature `"LatticeDistribution"` which fills slot `lattice` accordingly.

isOldVersion

  `signature(object = "ANY")`: throws an error if `isClass(class(object))` is `FALSE`, i.e.; if the class of `object` is no formal (S4) class. Else it checks whether all slots of the actual class definition may be accessed and if so returns `FALSE` and else `TRUE` and issues a warning.

conv2NewVersion

  `signature(object = "ANY")`: Generates a valid copy of `object` (according to the actual class definition), using the slots of `object` where possible and for the slots which are not yet present in `object` (because it was generated by an older version of the class definition), it generates a prototype object of the class of `object` with `new(class(object))` and uses the slot values of this prototype to fill the missing slots.

conv2NewVersion

  `signature(object = "LatticeDistribution")`: Generates a valid copy of `object` (according to the actual class definition, i.e.; with a corresponding `lattice`-slot), by generating a new instance of this object by `new(class(object), <list-of-parameters>`.

[Package distr version 2.8.0 Index]