From ripley@stats.ox.ac.uk  Thu Jan 30 21:59:03 2003
From: ripley@stats.ox.ac.uk (ripley@stats.ox.ac.uk)
Date: Thu Jan 30 21:59:03 2003
Subject: [Rd] vector passed to `if' in `pgamma'
In-Reply-To: <Pine.GSO.4.10.10301301228220.23275-100000@quetelet.stat.ucla.edu>
Message-ID: <Pine.LNX.4.44.0301302057240.22460-100000@gannet.stats>

thanks, but that's way overkill: if (any(shape <= 0)) will do.


On Thu, 30 Jan 2003, Roger Peng wrote:

> In the current R-devel sources, the `pgamma' function gives a warning when
> the `shape' argument is passed as a vector of length > 1.  That is,
> 
> > pgamma(3, 1)
> [1] 0.950213
> > pgamma(3, c(1, 2))
> [1] 0.9502129 0.8008517
> Warning message: 
> the condition has length > 1 and only the first element will be used in:
> if (shape <= 0) stop("shape must be strictly positive") 
> 
> Maybe something like
> 
> if(identical(any(shape <= 0), TRUE))
>   ....
> 
> ?
> 
> 
> > version
>          _                           
> platform i686-pc-linux-gnu           
> arch     i686                        
> os       linux-gnu                   
> system   i686, linux-gnu             
> status   Under development (unstable)
> major    1                           
> minor    7.0                         
> year     2003                        
> month    01                          
> day      29                          
> language R                           
> 
> 
> -roger
> _______________________________
> UCLA Department of Statistics
> rpeng@stat.ucla.edu
> http://www.stat.ucla.edu/~rpeng
> 
> ______________________________________________
> R-devel@stat.math.ethz.ch mailing list
> http://www.stat.math.ethz.ch/mailman/listinfo/r-devel
> 

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] vector passed to `if' in `pgamma'
ripley@stats.ox.ac.uk