Hi David and Dimitris,
Thanks for your suggestions. They are very helpful.
Jeff
On Wed, November 11, 2009 12:12 pm, David Winsemius wrote:
>
> On Nov 11, 2009, at 10:57 AM, David Winsemius wrote:
>
>
>>
>> On Nov 11, 2009, at 10:36 AM, Dimitris Rizopoulos wrote:
>>
>>
>>> one approach is the fo
On Nov 11, 2009, at 10:57 AM, David Winsemius wrote:
On Nov 11, 2009, at 10:36 AM, Dimitris Rizopoulos wrote:
one approach is the following:
mat <- rbind(c(-1, -1, 2, NA), c(3, 3, -2, -1), c(1, 1, NA, -2))
mat / ave(abs(mat), row(mat), sign(mat), FUN = sum)
Very elegant. My solution was
On Nov 11, 2009, at 10:36 AM, Dimitris Rizopoulos wrote:
one approach is the following:
mat <- rbind(c(-1, -1, 2, NA), c(3, 3, -2, -1), c(1, 1, NA, -2))
mat / ave(abs(mat), row(mat), sign(mat), FUN = sum)
Very elegant. My solution was a bit more pedestrian, but may have some
speed advanta
one approach is the following:
mat <- rbind(c(-1, -1, 2, NA), c(3, 3, -2, -1), c(1, 1, NA, -2))
mat / ave(abs(mat), row(mat), sign(mat), FUN = sum)
I hope it helps.
Best,
Dimitris
Hao Cen wrote:
Hi,
I have a matrix with positive numbers, negative numbers, and NAs. An
example of the matrix
Hi,
I have a matrix with positive numbers, negative numbers, and NAs. An
example of the matrix is as follows
-1 -1 2 NA
3 3 -2 -1
1 1 NA -2
I need to compute a scaled version of this matrix. The scaling method is
dividing each positive numbers in each row by the sum of positive numbers
in that r
5 matches
Mail list logo