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
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
;>
>>>
>>>
>>> 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
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
#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
'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]
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
...)
> 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
: 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
'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
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
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
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
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
.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]
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.
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
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
;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
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
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?
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
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
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
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
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
_
26 matches
Mail list logo