[Rd] vector passed to `if' in `pgamma'

Roger Peng rpeng@stat.ucla.edu
Thu Jan 30 21:43:02 2003


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