Suppose I have the following matrix

> class(cov_50)
[1] "matrix"
> cov_50
          [,1]     [,2]
[1,] 0.3201992 2.308084
[2,] 6.7312928 5.719641

I then use the following function via apply and get the desired output, a list

signif <- function(x) which(abs(x) > 1.96)
apply(cov_50, 1, signif)

> apply(cov_50, 1, signif)
[[1]]
[1] 2

[[2]]
[1] 1 2

However, I can't see why the following occurs

> class(cov_25)
[1] "matrix"
> cov_25
          [,1]     [,2]
[1,] 12.116106 14.81248
[2,]  5.492176  4.73138

>  apply(cov_25, 1, signif)
     [,1] [,2]
[1,]    1    1
[2,]    2    2

So, using the same function (signif) on a different object of the same class yields a matrix and *not* a list as desired.

I can't see any reason for the different output.

> sessionInfo()
R version 2.12.2 (2011-02-25)
Platform: x86_64-pc-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] quantreg_4.57 SparseM_0.86

	[[alternative HTML version deleted]]

