[S] S+ bug?
FRANK J JEN (FRANK.J.JEN@spcorp.com)
Wed, 21 Oct 1998 13:15:56 -0400
S+ Users,
I want to delete the rows from a matrix if either elememt in a row is NA.
The following procedure gave me the result I want.
> x_c(1, 2, NA, 4, NA)
> y_c(1, NA, NA, 4, NA)
> xy_cbind(x,y)
> xy.nomissing_xy[!is.na(xy[,1]) & !is.na(xy[,2]), ]
> xy.nomissing
x y
[1,] 1 1
[2,] 4 4
> dim(xy.nomissing)
[1] 2 2
>
However, the following did not give me the result I wanted.
> y[4]_NA
> xy_cbind(x,y)
> xy.nomissing_xy[!is.na(xy[,1]) & !is.na(xy[,2]), ]
> xy.nomissing
x y
1 1
> dim(xy.nomissing)
NULL
>
> length(xy.nomissing)
[1] 2
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).
Any comments?
Frank
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news