distroptions {distr}R Documentation

function to change the global variables of the package 'distr'

Description

With distroptions you may inspect and change the global variables used by the package `distr'

Usage

distroptions(arg = "missing", value = -1)

Arguments

arg the global variable to be shown or changed
value the new value of the global variable

Value

distroptions() returns a list of the global variables. distroptions(arg=x) returns the global variable x. distroptions(arg=x,value=y) sets the value of the global variable x to y.

Author(s)

Thomas Stabla Thomas.Stabla@uni-bayreuth.de,
Florian Camphausen Florian.Camphausen@uni-bayreuth.de,
Peter Ruckdeschel Peter.Ruckdeschel@uni-bayreuth.de,
Matthias Kohl Matthias.Kohl@uni-bayreuth.de

Examples

distroptions("RtoDPQ.e") # returns the value of RtoDPQ.e, by default = 5
distroptions("RtoDPQ.e",6) # now RtoDPQ.e = 6

## The function is currently defined as
function (arg = "missing", value = -1) 
{
    globals <- list(DefaultNrFFTGridPointsExponent = DefaultNrFFTGridPointsExponent, 
        DefaultNrGridPoints = DefaultNrGridPoints, DistrResolution = DistrResolution, 
        RtoDPQ.e = RtoDPQ.e, TruncQuantile = TruncQuantile)
    if (arg == "missing") {
        print(globals)
        return(invisible())
    }
    if (!any(arg == names(globals))) 
        stop(paste("No such variable:", arg))
    if (value == -1) 
        switch(arg, DefaultNrGridPoints = DefaultNrGridPoints, 
            DistrResolution = DistrResolution, TruncQuantile = TruncQuantile, 
            DefaultNrFFTGridPointsExponent = DefaultNrFFTGridPointsExponent, 
            RtoDPQ.e = RtoDPQ.e)
    else eval.parent(parse(text = paste("assignInNamespace(\"", 
        arg, "\",", value, ", \"distr\")", sep = "")))
  }

[Package distr version 1.5 Index]