See ?colSums.
Andy
From: Martin C. Martin
Hi,
I have a 5x731 array A, and I want to compute the sums of the
columns.
Currently I do:
apply(A, 2, sum)
But it turns out, this is slow: 70% of my CPU time is spent
here, even
though there are many complicated steps in my
colSums() is a lot faster.
Reid Huntsinger
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Martin C. Martin
Sent: Friday, August 05, 2005 12:17 PM
To: r-help@stat.math.ethz.ch
Subject: [R] Computing sums of the columns of an array
Hi,
I have a 5x731
Martin C. Martin wrote:
Hi,
I have a 5x731 array A, and I want to compute the sums of the columns.
Currently I do:
apply(A, 2, sum)
colSums(A)
Uwe Ligges
But it turns out, this is slow: 70% of my CPU time is spent here, even
though there are many complicated steps in my
On 8/5/2005 12:16 PM, Martin C. Martin wrote:
Hi,
I have a 5x731 array A, and I want to compute the sums of the columns.
Currently I do:
apply(A, 2, sum)
But it turns out, this is slow: 70% of my CPU time is spent here, even
though there are many complicated steps in my computation.
On Fri, 2005-08-05 at 12:16 -0400, Martin C. Martin wrote:
Hi,
I have a 5x731 array A, and I want to compute the sums of the columns.
Currently I do:
apply(A, 2, sum)
But it turns out, this is slow: 70% of my CPU time is spent here, even
though there are many complicated steps in my
Duncan Murdoch wrote:
On 8/5/2005 12:16 PM, Martin C. Martin wrote:
Hi,
I have a 5x731 array A, and I want to compute the sums of the columns.
Currently I do:
apply(A, 2, sum)
But it turns out, this is slow: 70% of my CPU time is spent here, even
though there are many complicated steps
Thanks everyone.
Gavin Simpson wrote:
But neither is that slow on my system. What is A?
It's in the middle of a loop. I'm doing some maximum likelihood
estimation, and having to evaluate my model over and over again for
different parameter values.
Thanks,
Martin
Duncan Murdoch wrote:
On 8/5/2005 12:43 PM, Uwe Ligges wrote:
Duncan Murdoch wrote:
On 8/5/2005 12:16 PM, Martin C. Martin wrote:
Hi,
I have a 5x731 array A, and I want to compute the sums of the
columns. Currently I do:
apply(A, 2, sum)
But it turns out, this is slow: 70% of my