lliam Dunlap [mailto:wdun...@tibco.com]
Sent: Friday, May 15, 2009 10:09 AM
To: Ping-Hsun Hsieh
Subject: RE: [R] memory usage grows too fast
rowMeans(dataMatrix=="02") must
(a) make a logical matrix the dimensions of dataMatrix in which to put
the result of dataMatrix=="02"
lto:palsp...@hortresearch.co.nz]
Sent: Thursday, May 14, 2009 4:47 PM
To: Ping-Hsun Hsieh
Subject: RE: [R] memory usage grows too fast
Tena koe Mike
If I understand you correctly, you should be able to use something like:
apply(yourMatrix, 1, function(x)
length(x[x==yourPattern]))/ncol(yourMatrix
On Thu, May 14, 2009 at 6:21 PM, Ping-Hsun Hsieh wrote:
> Hi All,
>
> I have a 1000x100 matrix.
> The calculation I would like to do is actually very simple: for each row,
> calculate the frequency of a given pattern. For example, a toy dataset is as
> follows.
>
> Col1 Col2 Col3 Co
Hi All,
I have a 1000x100 matrix.
The calculation I would like to do is actually very simple: for each row,
calculate the frequency of a given pattern. For example, a toy dataset is as
follows.
Col1Col2Col3Col4
01 02 02 00 => Freq of “02” is 0.5
02
4 matches
Mail list logo