It's because your first example produces answers of varying length so
there's no natural way to coerce it to a matrix. Your second has a
consistent length so the result can be made into a matrix.
Michael
On Thu, Dec 8, 2011 at 4:30 PM, Doran, Harold wrote:
> Suppose I have the following matrix
>
On Dec 8, 2011, at 3:30 PM, Doran, Harold wrote:
> 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
>
>
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)
>
3 matches
Mail list logo