Re: [S] S+ bug?

Alan Zaslavsky (
Wed, 21 Oct 1998 13:35:14 -0400 (EDT)

> From: (FRANK J JEN)
> That is, if there is only one row that both elements are not NA,
> the same procedure gives a vector (of length 2) instead of a
> matrix (of dimension 1x2).

This design decision was hotly argued during the development of S version
3 (back around 1987) and the decision was that the default would be that
subscripting that selects a single value in any dimension would drop that
dimension. This is how we make vectors out of columns of matrices. However,
the opposite treatment (keep matrix regardless) is still available:

xy.nomissing_xy[![,1]) & ![,2]), ,drop=F]

HOWEVER, even this won't work if no rows are selected! (in current version
of S) In fact 0-dimension arrays are not allowed so you can't keep the
matrix structure then. Moral of the story: special cases you always
have among you. (I think that S version 4 allows 0-dimension arrays,
but I'm not sure.)
This message was distributed by To unsubscribe
send e-mail to with the BODY of the
message: unsubscribe s-news