I have a large number of 3d tables that I wish to sum
Is there an efficient way to do this? Or perhaps a function I can call?
I tried using do.call(sum,listoftables) but that returns a single value.
So far, it seems only a loop will do the job.
TIA,
DAV
On Mon, Apr 16, 2012 at 10:28:43AM -0400, David A Vavra wrote:
I have a large number of 3d tables that I wish to sum
Is there an efficient way to do this? Or perhaps a function I can call?
I tried using do.call(sum,listoftables) but that returns a single value.
So far, it seems only a
Look at the Reduce function.
On Mon, Apr 16, 2012 at 8:28 AM, David A Vavra dava...@verizon.net wrote:
I have a large number of 3d tables that I wish to sum
Is there an efficient way to do this? Or perhaps a function I can call?
I tried using do.call(sum,listoftables) but that returns a
Define sum . Do you mean you want to get a single sum for each
array? -- get marginal sums for each array? -- get a single array in
which each value is the sum of all the individual values at the
position?
Due thought and consideration for those trying to help by formulating
your query carefully
suggestion for using reduce seems in order but as yet I'm unfamiliar
with the function.
DAV
-Original Message-
From: Bert Gunter [mailto:gunter.ber...@gene.com]
Sent: Monday, April 16, 2012 12:42 PM
To: Greg Snow
Cc: David A Vavra; r-help@r-project.org
Subject: Re: [R] Effeciently sum 3d
] On
Behalf Of Petr Savicky
Sent: Monday, April 16, 2012 11:07 AM
To: r-help@r-project.org
Subject: Re: [R] Effeciently sum 3d table
On Mon, Apr 16, 2012 at 10:28:43AM -0400, David A Vavra wrote:
I have a large number of 3d tables that I wish to sum
Is there an efficient way to do this? Or perhaps
: r-help@r-project.org
Subject: Re: [R] Effeciently sum 3d table
Look at the Reduce function.
On Mon, Apr 16, 2012 at 8:28 AM, David A Vavra dava...@verizon.net wrote:
I have a large number of 3d tables that I wish to sum
Is there an efficient way to do this? Or perhaps a function I can call?
I
Message-
From: Bert Gunter [mailto:gunter.ber...@gene.com]
Sent: Monday, April 16, 2012 12:42 PM
To: Greg Snow
Cc: David A Vavra; r-help@r-project.org
Subject: Re: [R] Effeciently sum 3d table
Define sum . Do you mean you want to get a single sum for each
array? -- get marginal sums
] On
Behalf Of Petr Savicky
Sent: Monday, April 16, 2012 11:07 AM
To: r-help@r-project.org
Subject: Re: [R] Effeciently sum 3d table
On Mon, Apr 16, 2012 at 10:28:43AM -0400, David A Vavra wrote:
I have a large number of 3d tables that I wish to sum
Is there an efficient way to do this? Or perhaps
: Monday, April 16, 2012 11:35 AM
To: 'Bert Gunter'
Cc: r-help@r-project.org
Subject: Re: [R] Effeciently sum 3d table
Thanks Gunter,
I mean what I think is the normal definition of 'sum' as in:
T1 + T2 + T3 + ...
It never occurred to me that there would be a question.
I have gotten
DAV
-Original Message-
From: Bert Gunter [mailto:gunter.ber...@gene.com]
Sent: Monday, April 16, 2012 3:07 PM
To: David A Vavra
Cc: r-help@r-project.org
Subject: Re: [R] Effeciently sum 3d table
David:
1. My first name is Bert.
2. It never occurred to me that there would be a question
Cheers,
DAV
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org
] On
Behalf Of Petr Savicky
Sent: Monday, April 16, 2012 11:07 AM
To: r-help@r-project.org
Subject: Re: [R] Effeciently sum 3d table
On Mon, Apr 16, 2012 at 10:28:43AM
[mailto:dwinsem...@comcast.net]
Sent: Monday, April 16, 2012 3:26 PM
To: David A Vavra
Cc: 'Petr Savicky'; r-help@r-project.org
Subject: Re: [R] Effeciently sum 3d table
On Apr 16, 2012, at 2:43 PM, David A Vavra wrote:
Thanks Petr,
I'm after T1 + T2 + T3 + ...
Which would be one number ... i.e
, USE.NAMES = USE.NAMES))
}
environment: 0x7fb3442553c8
DAV
-Original Message-
From: Bert Gunter [mailto:gunter.ber...@gene.com]
Sent: Monday, April 16, 2012 3:07 PM
To: David A Vavra
Cc: r-help@r-project.org
Subject: Re: [R] Effeciently sum 3d table
David:
1. My first name is Bert
...@tibco.com]
Sent: Monday, April 16, 2012 3:26 PM
To: David A Vavra; 'Bert Gunter'
Cc: r-help@r-project.org
Subject: RE: [R] Effeciently sum 3d table
Example in partial code:
Env - CreatEnv() # my own function
Assign('final',T1-T1,envir=env)
L-listOfTables
lapply(L,function(t
Dunlap [mailto:wdun...@tibco.com]
Sent: Monday, April 16, 2012 3:26 PM
To: David A Vavra; 'Bert Gunter'
Cc: r-help@r-project.org
Subject: RE: [R] Effeciently sum 3d table
Example in partial code:
Env - CreatEnv() # my own function
Assign('final',T1-T1,envir=env)
L-listOfTables
that sentence.
Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com
From: David A Vavra [mailto:dava...@verizon.net]
Sent: Monday, April 16, 2012 1:20 PM
To: William Dunlap
Cc: r-help@r-project.org
Subject: RE: [R] Effeciently sum 3d table
Thanks Bill,
For reasons that aren't important here
]),
SIMPLIFY = SIMPLIFY, USE.NAMES = USE.NAMES))
}
environment: 0x7fb3442553c8
DAV
-Original Message-
From: Bert Gunter [mailto:gunter.ber...@gene.com]
Sent: Monday, April 16, 2012 3:07 PM
To: David A Vavra
Cc: r-help@r-project.org
Subject: Re: [R] Effeciently sum 3d table
David:
1. My
(),
PACKAGE = base)
... etc.
-Original Message-
From: Bert Gunter [mailto:gunter.ber...@gene.com]
Sent: Monday, April 16, 2012 4:13 PM
To: David A Vavra
Cc: r-help@r-project.org
Subject: Re: [R] Effeciently sum 3d table
For purposes of clarity only...
On Mon, Apr 16, 2012
, April 16, 2012 3:26 PM
To: David A Vavra
Cc: 'Petr Savicky'; r-help@r-project.org
Subject: Re: [R] Effeciently sum 3d table
On Apr 16, 2012, at 2:43 PM, David A Vavra wrote:
Thanks Petr,
I'm after T1 + T2 + T3 + ...
Which would be one number ... i.e. the result you originally said you
did
-
From: Greg Snow [mailto:538...@gmail.com]
Sent: Monday, April 16, 2012 11:54 AM
To: David A Vavra
Cc: r-help@r-project.org
Subject: Re: [R] Effeciently sum 3d table
Look at the Reduce function.
On Mon, Apr 16, 2012 at 8:28 AM, David A Vavra dava...@verizon.net wrote:
I have a large number
-
From: Greg Snow [mailto:538...@gmail.com]
Sent: Monday, April 16, 2012 11:54 AM
To: David A Vavra
Cc: r-help@r-project.org
Subject: Re: [R] Effeciently sum 3d table
Look at the Reduce function.
On Mon, Apr 16, 2012 at 8:28 AM, David A Vavra
dava...@verizon.net wrote:
I have a large number
Message-
From: William Dunlap [mailto:wdun...@tibco.com]
Sent: Monday, April 16, 2012 3:26 PM
To: David A Vavra; 'Bert Gunter'
Cc: r-help@r-project.org
Subject: RE: [R] Effeciently sum 3d table
Example in partial code:
Env - CreatEnv() # my own function
Assign('final',T1-T1,envir
; 'Bert Gunter'
Cc: r-help@r-project.org
Subject: RE: [R] Effeciently sum 3d table
Example in partial code:
Env - CreatEnv() # my own function
Assign('final',T1-T1,envir=env)
L-listOfTables
lapply(L,function(t) {
final - get('final',envir=env) + t
assign('final',final
, April 16, 2012 4:55 PM
To: David A Vavra
Cc: r-help@r-project.org
Subject: Re: [R] Effeciently sum 3d table
On Apr 16, 2012, at 4:04 PM, David A Vavra wrote:
even now you _could_ be clearer
I fail to see why it's unclear.
I'm after T1 + T2 + T3 + ...
Which would be one number ... i.e
A Vavra
Cc: r-help@r-project.org
Subject: Re: [R] Effeciently sum 3d table
Here is a simple example:
mylist - replicate(4, matrix(rnorm(12), ncol=3), simplify=FALSE)
A - Reduce( `+`, mylist )
B - mylist[[1]] + mylist[[2]] + mylist[[3]] + mylist[[4]]
all.equal(A,B)
[1] TRUE
Basically what
26 matches
Mail list logo