stefan.petersson wrote:
>
>
> ng,
>
> I have a matrix (x) with binary content. Each row of the matrix holds
> exactly one 1, and the rest of the row is zeros. The thing is that I need
> to 'collapse' the matrix to one column where each row holds the original
> column index of the 1's (y). Som
e -
> From: <[EMAIL PROTECTED]>
> To:
> Sent: Wednesday, June 11, 2008 10:10 AM
> Subject: [R] Matrix transformation problem
>
>
>>
>> ng,
>>
>> I have a matrix (x) with binary content. Each row of the matrix
>> holds exactly one 1, and the
you may try a matrix multiplication, which has a very high performance in R
x%*%1:ncol(x)
hth.
[EMAIL PROTECTED] schrieb:
ng,
I have a matrix (x) with binary content. Each row of the matrix holds exactly
one 1, and the rest of the row is zeros. The thing is that I need to 'collapse'
the ma
June 11, 2008 10:10 AM
Subject: [R] Matrix transformation problem
ng,
I have a matrix (x) with binary content. Each row of the matrix
holds exactly one 1, and the rest of the row is zeros. The thing is
that I need to 'collapse' the matrix to one column where each row
holds the ori
uven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
http://www.student.kuleuven.be/~m0390867/dimitris.htm
- Original Message -
From: <[EMAIL PROTECTED]>
To:
Sent: Wednesday, June 11, 2008 10:10 AM
ng,
I have a matrix (x) with binary content. Each row of the matrix holds exactly
one 1, and the rest of the row is zeros. The thing is that I need to 'collapse'
the matrix to one column where each row holds the original column index of the
1's (y). Sometimes, the matrix is quite large, so I h
6 matches
Mail list logo