Hello,
See the help page for ?lower.tri.
If your matrix is named 'x', something like
x[upper.tri(x)]
Hope this helps,
Rui Barradas
Citando Denis Francisci :
> Hi all,
> I've a simple question.
> I have a matrix with same values over and under the diagonal. That's an
> example:
> [,1] [,2]
Thank you very much,
just what I needed!!
2016-05-16 18:25 GMT+02:00 Duncan Murdoch :
> On 16/05/2016 12:10 PM, Denis Francisci wrote:
>
>> Hi all,
>> I've a simple question.
>> I have a matrix with same values over and under the diagonal. That's an
>> example:
>>[,1] [,2] [,3]
>> [1,]
?lower.tri
> tmp <- matrix(scan(text=" NaN 45 63.43495
+ 45.0 NaN 90.0
+ 63.43495 90 NaN"), 3, 3)
Read 9 items
> tmp
[,1] [,2] [,3]
[1,] NaN 45 63.43495
[2,] 45.0 NaN 90.0
[3,] 63.43495 90 NaN
> lower.tri(tmp)
[,1] [,2] [,3]
[1,] FA
On 16/05/2016 12:10 PM, Denis Francisci wrote:
Hi all,
I've a simple question.
I have a matrix with same values over and under the diagonal. That's an
example:
[,1] [,2] [,3]
[1,] NaN 45 63.43495
[2,] 45.0 NaN 90.0
[3,] 63.43495 90 NaN
How can I extract just the thre
How about:
> mymat <- matrix(c(NA, 45, 63, 45, NA, 90, 63, 90, NA), byrow=TRUE, nrow=3)
> mymat
[,1] [,2] [,3]
[1,] NA 45 63
[2,] 45 NA 90
[3,] 63 90 NA
> mymat[row(mymat) < col(mymat)]
[1] 45 63 90
On Mon, May 16, 2016 at 12:10 PM, Denis Francisci wrote:
> Hi all,
> I'v
Hi all,
I've a simple question.
I have a matrix with same values over and under the diagonal. That's an
example:
[,1] [,2] [,3]
[1,] NaN 45 63.43495
[2,] 45.0 NaN 90.0
[3,] 63.43495 90 NaN
How can I extract just the three values over (or under) the diagonal and
convert
6 matches
Mail list logo