Methods for Version Management in Package ‘distr’

Share:

Description

Version-Management-methods

Usage

1
2
3
4
5
6
7
8
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>.

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.