R-alpha: Seg. fault in tapply

Andreas Weingessel Andreas.Weingessel@ci.tuwien.ac.at
Thu, 24 Apr 1997 12:24:10 +0200



Calling tapply with a NULL as INDEX argument causes a segmentation
fault on an i-586-linux machine.

So, if for example
	 y<-list(a=3D1:10,b=3D2:5)
then
	tapply(y$a,y$c,mean)
causes a segmentation fault.=20

This seg. fault is produced when a dimension of length integer(0) is
assigned to a list with one element and this object is shown
afterwards. E.g.:

R>  y<-list(a=3D1:10)
R> dim(y) <- integer(length(NULL))
R> y
Segmentation fault

This happens in the code of tapply, when INDEX=3DNULL in the lines

  extent <- integer(length(INDEX))
and
  dim(ans) <- extent


Regards,
	Andreas

************************************************************************
*                          Andreas Weingessel                          *
************************************************************************
* Institut f=FCr Statistik      *                Tel: (+43 1) 58801 4541 =
*
* Technische Universit=E4t Wien *                Fax: (+43 1)  504 14 98 =
*
* Wiedner Hauptstr. 8-10/1071 *     Andreas.Weingessel@ci.tuwien.ac.at *
* A-1040 Wien, Austria        * http://www.ci.tuwien.ac.at/~weingessel *
************************************************************************

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-