[Distr-commits] r1085 - in pkg/distr: . R inst man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Jan 21 12:52:57 CET 2016
Author: ruckdeschel
Date: 2016-01-21 12:52:57 +0100 (Thu, 21 Jan 2016)
New Revision: 1085
Modified:
pkg/distr/NAMESPACE
pkg/distr/R/AllGenerics.R
pkg/distr/R/Distribution.R
pkg/distr/inst/NEWS
pkg/distr/man/p-methods.Rd
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: pkg/distr/NAMESPACE
===================================================================
--- pkg/distr/NAMESPACE 2016-01-21 11:52:20 UTC (rev 1084)
+++ pkg/distr/NAMESPACE 2016-01-21 11:52:57 UTC (rev 1085)
@@ -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: pkg/distr/R/AllGenerics.R
===================================================================
--- pkg/distr/R/AllGenerics.R 2016-01-21 11:52:20 UTC (rev 1084)
+++ pkg/distr/R/AllGenerics.R 2016-01-21 11:52:57 UTC (rev 1085)
@@ -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: pkg/distr/R/Distribution.R
===================================================================
--- pkg/distr/R/Distribution.R 2016-01-21 11:52:20 UTC (rev 1084)
+++ pkg/distr/R/Distribution.R 2016-01-21 11:52:57 UTC (rev 1085)
@@ -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: pkg/distr/inst/NEWS
===================================================================
--- pkg/distr/inst/NEWS 2016-01-21 11:52:20 UTC (rev 1084)
+++ pkg/distr/inst/NEWS 2016-01-21 11:52:57 UTC (rev 1085)
@@ -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: pkg/distr/man/p-methods.Rd
===================================================================
--- pkg/distr/man/p-methods.Rd 2016-01-21 11:52:20 UTC (rev 1084)
+++ pkg/distr/man/p-methods.Rd 2016-01-21 11:52:57 UTC (rev 1085)
@@ -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: pkg/distr/man/q-methods.Rd
===================================================================
--- pkg/distr/man/q-methods.Rd 2016-01-21 11:52:20 UTC (rev 1084)
+++ pkg/distr/man/q-methods.Rd 2016-01-21 11:52:57 UTC (rev 1085)
@@ -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