Re: [R] Effeciently sum 3d table

2012-04-16 Thread David A Vavra
vid 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.equa

Re: [R] Effeciently sum 3d table

2012-04-16 Thread David A Vavra
onday, 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

Re: [R] Effeciently sum 3d table

2012-04-16 Thread Bert Gunter
;> >>> >>> >>> For reasons that aren't important here, I must start from a list. >>> Computing >>> the sum while generating the tables may be a solution but it means doing >>> something in one piece of code that is unrelated to the

Re: [R] Effeciently sum 3d table

2012-04-16 Thread David Winsemius
ny timing but because of the extra operations of get and assign, the non-loop implementation will likely suffer. It seems you have shown this to be true. DAV -Original Message- From: William Dunlap [mailto:wdun...@tibco.com] Sent: Monday, April 16, 2012 3:26 PM To: David A Vavra; 'Be

Re: [R] Effeciently sum 3d table

2012-04-16 Thread David Winsemius
#x27;s an item in the examples which may be exactly what I'm after. DAV -Original Message- 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

Re: [R] Effeciently sum 3d table

2012-04-16 Thread Greg Snow
's > an item in the examples which may be exactly what I'm after. > > DAV > > > -Original Message- > 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]

Re: [R] Effeciently sum 3d table

2012-04-16 Thread David Winsemius
lto: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 num

Re: [R] Effeciently sum 3d table

2012-04-16 Thread Bert Gunter
...) >    answer <- .Call("do_mapply", FUN, dots, MoreArgs, environment(), >        PACKAGE = "base") > > ... etc. > > > -Original Message- > From: Bert Gunter [mailto:gunter.ber...@gene.com] > Sent: Monday, April 16, 2012 4:13 PM > To: David A

Re: [R] Effeciently sum 3d table

2012-04-16 Thread David A Vavra
: 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 at 12:40 PM, David A Vavra wrote: > Bert, > > My apologies on the name. > > I haven't kept any data on loop times. I don't know why lapp

Re: [R] Effeciently sum 3d table

2012-04-16 Thread William Dunlap
'values'. I guess I misinterpreted 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

Re: [R] Effeciently sum 3d table

2012-04-16 Thread Bert Gunter
It seems you have > shown this to be true. > > > > DAV > > > > > > -Original 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 > S

Re: [R] Effeciently sum 3d table

2012-04-16 Thread David A Vavra
lliam 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('fin

Re: [R] Effeciently sum 3d table

2012-04-16 Thread Bert Gunter
e names(args) >    dovec <- names %in% vectorize.args >    do.call("mapply", c(FUN = FUN, args[dovec], MoreArgs = > list(args[!dovec]), >        SIMPLIFY = SIMPLIFY, USE.NAMES = USE.NAMES)) > } > > > DAV > > > -----Original Message----- > From: Bert Gunter [mailto:gunt

Re: [R] Effeciently sum 3d table

2012-04-16 Thread David A Vavra
Message- From: David Winsemius [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

Re: [R] Effeciently sum 3d table

2012-04-16 Thread David Winsemius
.157 > identical(Reduce("+", L), final) [1] TRUE 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]

Re: [R] Effeciently sum 3d table

2012-04-16 Thread David A Vavra
s[!dovec]), SIMPLIFY = SIMPLIFY, USE.NAMES = USE.NAMES)) } 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.

Re: [R] Effeciently sum 3d table

2012-04-16 Thread William Dunlap
CO Software wdunlap tibco.com > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf > Of David A Vavra > Sent: Monday, April 16, 2012 11:35 AM > To: 'Bert Gunter' > Cc: r-help@r-project.org > Subjec

Re: [R] Effeciently sum 3d table

2012-04-16 Thread David Winsemius
oject.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 -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 thi

Re: [R] Effeciently sum 3d table

2012-04-16 Thread Bert Gunter
;final',final,envir=env) >        NULL > }) > > But I was hoping for a more elegant and hopefully more efficient solution. > Greg's suggestion for using reduce seems in order but as yet I'm unfamiliar > with the function. > > DAV > > > > -Original Mess

Re: [R] Effeciently sum 3d table

2012-04-16 Thread David A Vavra
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 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 fu

Re: [R] Effeciently sum 3d table

2012-04-16 Thread David A Vavra
g] 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?

Re: [R] Effeciently sum 3d table

2012-04-16 Thread David A Vavra
for a more elegant and hopefully more efficient solution. Greg's 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 C

Re: [R] Effeciently sum 3d table

2012-04-16 Thread Bert Gunter
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

Re: [R] Effeciently sum 3d table

2012-04-16 Thread Greg Snow
Look at the Reduce function. On Mon, Apr 16, 2012 at 8:28 AM, 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. > > S

Re: [R] Effeciently sum 3d table

2012-04-16 Thread Petr Savicky
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 onl

[R] Effeciently sum 3d table

2012-04-16 Thread David A Vavra
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 _