tabulate causes segmentation fault (PR#156)

Peter Dalgaard BSA p.dalgaard@biostat.ku.dk
03 Apr 1999 11:34:08 +0200


wvenable@arcola.stats.adelaide.edu.au writes:

> Peter,
> 
> I thought this one was noted and fixed, but I could be wrong.
> 
>     R : Copyright 1999, The R Development Core Team
>     Version 0.63.3  (March 6, 1999)
>     
>     ....
>     
>     [Previously saved workspace restored]
>     
>     > tabulate(1:10, 5)
>     
>     Process R:1 segmentation fault at Sat Apr  3 17:48:34 1999

It wasn't...

However, all it needs is a bit of defensive programming. But should it

(a) Protest if any(bin)>nbins
or 
(b) Quietly set bin[bin>nbins] <- 0  # or NA, no matter

(one could also start the routine with bin<-bin[bin<=nbin])

I think (b) since that is consistent with the way values <= 0 are
currently handled.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._