[Distr-commits] r1084 - in branches/distr-2.7/pkg/distr: . R inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Jan 21 12:52:21 CET 2016


Author: ruckdeschel
Date: 2016-01-21 12:52:20 +0100 (Thu, 21 Jan 2016)
New Revision: 1084

Modified:
   branches/distr-2.7/pkg/distr/NAMESPACE
   branches/distr-2.7/pkg/distr/R/AllGenerics.R
   branches/distr-2.7/pkg/distr/R/Distribution.R
   branches/distr-2.7/pkg/distr/inst/NEWS
   branches/distr-2.7/pkg/distr/man/p-methods.Rd
   branches/distr-2.7/pkg/distr/man/q-methods.Rd
Log:
distr:: new Methods p.r and q.l, synonyma for p and q (useful for use in RStudio)

Modified: branches/distr-2.7/pkg/distr/NAMESPACE
===================================================================
--- branches/distr-2.7/pkg/distr/NAMESPACE	2016-01-15 16:42:34 UTC (rev 1083)
+++ branches/distr-2.7/pkg/distr/NAMESPACE	2016-01-21 11:52:20 UTC (rev 1084)
@@ -84,7 +84,7 @@
               "discretePart", "discretePart<-", "acPart", "acPart<-",
               "discreteWeight", "discreteWeight<-", "acWeight", "acWeight<-",
               "p.discrete", "d.discrete", "q.discrete", "r.discrete",
-              "p.ac", "d.ac", "q.ac", "r.ac")
+              "p.ac", "d.ac", "q.ac", "r.ac", "p.r", "q.l")
 exportMethods("decomposePM", "simplifyD", "showobj")
 exportMethods("Truncate","Minimum","Maximum","Huberize")
 exportMethods("solve", "sqrt")

Modified: branches/distr-2.7/pkg/distr/R/AllGenerics.R
===================================================================
--- branches/distr-2.7/pkg/distr/R/AllGenerics.R	2016-01-15 16:42:34 UTC (rev 1083)
+++ branches/distr-2.7/pkg/distr/R/AllGenerics.R	2016-01-21 11:52:20 UTC (rev 1084)
@@ -185,6 +185,10 @@
    setGeneric("p.l", function(object) standardGeneric("p.l"))
 if(!isGeneric("q.r"))
    setGeneric("q.r", function(object) standardGeneric("q.r"))
+if(!isGeneric("p.r"))
+   setGeneric("p.r", function(object) standardGeneric("p.r"))
+if(!isGeneric("q.l"))
+   setGeneric("q.l", function(object) standardGeneric("q.l"))
 
 if(!isGeneric("gaps"))
    setGeneric("gaps", function(object) standardGeneric("gaps"))

Modified: branches/distr-2.7/pkg/distr/R/Distribution.R
===================================================================
--- branches/distr-2.7/pkg/distr/R/Distribution.R	2016-01-15 16:42:34 UTC (rev 1083)
+++ branches/distr-2.7/pkg/distr/R/Distribution.R	2016-01-21 11:52:20 UTC (rev 1084)
@@ -10,9 +10,12 @@
 setMethod("r", "Distribution", function(object) object at r)
 setMethod("d", "Distribution", function(object) object at d)
 setMethod("p", "Distribution", function(object) object at p)
+setMethod("p.r", "Distribution", function(object) object at p)
 setMethod("q", "Distribution", 
            function(save = "default", status = 0, runLast = TRUE) save at q)
            ### odd arg-list due to existing function in base package 
+setMethod("q.l", "Distribution", 
+           function(object) object at q)
 
 setMethod("p", "Distribution", function(object) object at p)
 setMethod(".lowerExact", "Distribution", function(object){ 

Modified: branches/distr-2.7/pkg/distr/inst/NEWS
===================================================================
--- branches/distr-2.7/pkg/distr/inst/NEWS	2016-01-15 16:42:34 UTC (rev 1083)
+++ branches/distr-2.7/pkg/distr/inst/NEWS	2016-01-21 11:52:20 UTC (rev 1084)
@@ -21,6 +21,12 @@
 + qqplot gains pattern substitution like plot in titles and x/y axis lables
 + pattern substitution can now be switched on and off in all plot 
   functions according to argument withSubst
++ new methods q.l and p.r as synonyma for slot accessors q and p --
+  the former one is useful in particular when using RStudio, as they
+  catch calls to q() [quitting an R session] and treat them separately
+  which renders calls to our method q() (with respective signature,
+  i.e., with a distribution as [first] argument) inaccessible from 
+  the console... so far only a call to distr::q was helping...
   
   
 under the hood:

Modified: branches/distr-2.7/pkg/distr/man/p-methods.Rd
===================================================================
--- branches/distr-2.7/pkg/distr/man/p-methods.Rd	2016-01-15 16:42:34 UTC (rev 1083)
+++ branches/distr-2.7/pkg/distr/man/p-methods.Rd	2016-01-21 11:52:20 UTC (rev 1084)
@@ -1,5 +1,8 @@
 \name{p-methods}
 \docType{methods}
+\alias{p.r-methods}
+\alias{p.r}
+\alias{p.r,Distribution-method}
 \alias{p-methods}
 \alias{p}
 \alias{p,Distribution-method}
@@ -8,12 +11,22 @@
 
 \section{Methods}{\describe{
 
-\item{p}{\code{signature(object = "Distribution")}: returns the cumulative distribution function,
-i.e.; \eqn{p.l(t) = P(object \le t)}{p.l(t) = P(object <= t)}  }
+\item{p}{\code{signature(object = "Distribution")}: returns the cumulative distribution function (c.d.f.),
+i.e.; \eqn{p(t) = P(object \le t)}{p(t) = P(object <= t)}  }
+\item{p.r}{\code{signature(object  = "Distribution")}: 
+from distr-2.6 onwards, we provide this as a synonym for 
+method \code{p}; this synonym more explicitely states that we are dealing with
+the right-continuous variant of a c.d.f.}
 }}
 \seealso{
-\code{\link{Distribution-class}}
+\code{\link{Distribution-class}}, \code{p.l}
 }
+\examples{
+require(distr)
+N <- Norm()
+p(N)(0.3)
+p.r(N)(0.3)
+}
 \keyword{distribution}
 \keyword{methods}
 \concept{cumulative distribution function}

Modified: branches/distr-2.7/pkg/distr/man/q-methods.Rd
===================================================================
--- branches/distr-2.7/pkg/distr/man/q-methods.Rd	2016-01-15 16:42:34 UTC (rev 1083)
+++ branches/distr-2.7/pkg/distr/man/q-methods.Rd	2016-01-21 11:52:20 UTC (rev 1084)
@@ -3,17 +3,37 @@
 \alias{q-methods}
 \alias{q}
 \alias{q,Distribution-method}
+\alias{q.l-methods}
+\alias{q.l}
+\alias{q.l,Distribution-method}
 \title{Methods for Function q in Package `distr'}
 \description{q-methods}
 
 \section{Methods}{\describe{
-\item{q}{\code{signature(object  = "Distribution")}: returns the
+\item{q}{\code{signature(save  = "Distribution")}: returns the
 (left-continuous) quantile function, i.e.;
-\eqn{{\rm q}(s)=\inf\{t \,\big|\, P({\tt object}\leq t)\geq s\}}{q(s)=inf\{t|P(object<=t)>=s\}}
+\eqn{{\rm q}(s)=\inf\{t \,\big|\, P({\tt object}\leq t)\geq s\}}{q(s)=inf\{t|P(object<=t)>=s\}}}
+\item{q.l}{\code{signature(object  = "Distribution")}: 
+from distr-2.6 onwards, we provide this as a synonym for 
+method \code{q}; this synonym more explicitely states that we are dealing with
+the left-continuous variant of a quantile function. It is useful in particular 
+when used from the console in RStudio, as RStudio catches calls to 
+\code{q()} and treats them separately from usual R evaluation.  
+The developers of RStudio have been asked to fix this and comply with standard 
+R evaluation which explicitely allows overloading \code{q()} as we do it in this 
+package, but so far have refused to do so, as they claim overloading 
+\code{q()} was insane.
 }}}
 \seealso{
-\code{\link{Distribution-class}}
+\code{\link{Distribution-class}}, \code{q.r}
 }
+\examples{
+require(distr)
+N <- Norm()
+q(N)(0.3)
+q.l(N)(0.3)
+}
+
 \keyword{distribution}
 \keyword{methods}
 \concept{pseudo-inverse distribution function}



More information about the Distr-commits mailing list