[Distr-commits] r942 - in branches/distr-2.6/pkg/distr: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Jul 24 14:22:36 CEST 2014


Author: ruckdeschel
Date: 2014-07-24 14:22:35 +0200 (Thu, 24 Jul 2014)
New Revision: 942

Modified:
   branches/distr-2.6/pkg/distr/R/internalUtils.R
   branches/distr-2.6/pkg/distr/man/internals.Rd
Log:
[distr] enhanced utility function .fillList by an automatic cast to list if the argument not yet is of class list.

Modified: branches/distr-2.6/pkg/distr/R/internalUtils.R
===================================================================
--- branches/distr-2.6/pkg/distr/R/internalUtils.R	2014-07-24 11:27:43 UTC (rev 941)
+++ branches/distr-2.6/pkg/distr/R/internalUtils.R	2014-07-24 12:22:35 UTC (rev 942)
@@ -1233,7 +1233,10 @@
 #------------------------------------------------------------------------------
 # fill a list acc. recycling rules
 #------------------------------------------------------------------------------
+.List <- function(list0) if(is.list(list0)) list0 else list(list0)
+
 .fillList <- function(list0, len = length(list0)){
+            list0 <- .List(list0)
             if(len == length(list0)) 
                return(list0)
             i <- 0

Modified: branches/distr-2.6/pkg/distr/man/internals.Rd
===================================================================
--- branches/distr-2.6/pkg/distr/man/internals.Rd	2014-07-24 11:27:43 UTC (rev 941)
+++ branches/distr-2.6/pkg/distr/man/internals.Rd	2014-07-24 12:22:35 UTC (rev 942)
@@ -124,6 +124,7 @@
 .csimpsum(fx)
 .primefun(f,x, nm = NULL)
 .IssueWarn(Arith,Sim)
+.List(list0)
 .fillList(list0, len=length(list0))
 .trunc.up(object, upper)
 .trunc.low(object, lower)
@@ -364,8 +365,13 @@
 of \code{cumsum}. \code{.primefun} is similar but more flexible and
 produces the prime function as a function.
 
+\code{.List} checks if argument already is a list, and if so leaves it as
+             it is, otherwise casts it to a list by a call to \code{list}.
+
 \code{.fillList} fills a new list with the elements of a given list \code{list0}
                  until length \code{len} is reached using recycling if necessary.
+                 Argument \code{list0} is cast to \code{list} by a call
+                 to \code{.List} if necessary.
 
 \code{.trunc.up}, \code{.trunc.low}  provide common routines for
 classes \code{DiscreteDistribution} and \code{AbscontDistribution} for 
@@ -442,6 +448,7 @@
 \item{.csimpsum}{a vector of evaluations of the prime function at the grid points.}
 \item{.primefun}{the prime function as a function.}
 \item{.IssueWarn}{a list with two warnings to be issued each of which may be empty.}
+\item{.List}{a list.}
 \item{.fillList}{a list.}
 \item{.trunc.up,.trunc.low}{a list with elements \code{r,p,d,q} (in this order).}
 \item{.DistrCollapse}{upon a suggestion by Jacob van Etten, 



More information about the Distr-commits mailing list