Learn R Programming

distr (version 2.9.5)

Version Management: Methods for Version Management in Package `distr'

Description

Version-Management-methods

Usage

isOldVersion(object)
conv2NewVersion(object)
# S4 method for ANY
isOldVersion(object)
# S4 method for ANY
conv2NewVersion(object)
# S4 method for 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>.