Hello everyone,

Considering the following code sample :

----
indexes <- function(vec) {
    vec <- which(vec==TRUE)
    return(vec)
}
mat <- matrix(FALSE, nrow=10, ncol=10)
mat[1,3] <- mat[3,1] <- TRUE
----

Issuing apply(mat, 1, indexes) returns a 10-cell list, as expected.
Now if I do:

----
mat[1,3] <- mat[3,1] <- FALSE
apply(mat, 1, indexes)
----

I would expect a 10-cell list with integer(0) in each cell - instead I get
integer(0), which wrecks my further process.
Is there a simple way to get the result I expect (and the only consistent
one, IMHO) ?

Thanks by advance for your help,

Pierrick Bruneau
http://www.bruneau44.com

	[[alternative HTML version deleted]]

