On Tue, Jun 2, 2009 at 10:44 AM, Wacek Kusnierczyk
wrote:
> Rainer M Krug wrote:
>> Thanks a lot Wacek for this clear description of the problem - I was
>> not aware, that it is that complex.
>> I definitely did not consider the initialize() function in writing my code.
>>
>> But as I only want to
Rainer M Krug wrote:
> Thanks a lot Wacek for this clear description of the problem - I was
> not aware, that it is that complex.
> I definitely did not consider the initialize() function in writing my code.
>
> But as I only want to allocate the space for the objects, it does not
> matter here. Bu
Thanks a lot Wacek for this clear description of the problem - I was
not aware, that it is that complex.
I definitely did not consider the initialize() function in writing my code.
But as I only want to allocate the space for the objects, it does not
matter here. But when I write a simulation and
Wacek Kusnierczyk wrote:
>
> consider:
>
> setClass('foo',
>representation=representation(content='environment'))
> setMethod('initialize', 'foo', function(.Object) {
> .obj...@content = new.env()
> .obj...@content$name = 'foo'
> .Object })
>
> foos = rep
Romain Francois wrote:
>
> rep( list( new("track") ), 5 )
> lapply( 1:5, function(x) new("track") )
> list( new("track") ) [ rep(1, 5 ) ]
but note: these are not all equivalent. the second creates a list of
five distinct objects, the first and last ones create a list of five
times the same object
On Mon, Jun 1, 2009 at 12:27 PM, Chuck Cleland wrote:
> On 6/1/2009 6:08 AM, Rainer M Krug wrote:
>> Hi
>>
>> I am doing an simulation, and I a large proportion of the simulation
>> time is taken up by memory allocations.
>>
>> I am creating an object, and storing it in a list of those objects.
>>
On Mon, Jun 1, 2009 at 12:19 PM, Romain Francois
wrote:
> Hi,
>
> Here are a few ways:
Thanks - I like it when I have a choice.
>
> rep( list( new("track") ), 5 )
OK - This one is executing new("track") once, and copying it into a list.
> lapply( 1:5, function(x) new("track") )
This one execu
On 6/1/2009 6:08 AM, Rainer M Krug wrote:
> Hi
>
> I am doing an simulation, and I a large proportion of the simulation
> time is taken up by memory allocations.
>
> I am creating an object, and storing it in a list of those objects.
>
> essentially:
>
> x <- list()
> for (t in 1:500) {
> x[1]
Hi,
Here are a few ways:
rep( list( new("track") ), 5 )
lapply( 1:5, function(x) new("track") )
list( new("track") ) [ rep(1, 5 ) ]
Romain
Rainer M Krug wrote:
Hi
I am doing an simulation, and I a large proportion of the simulation
time is taken up by memory allocations.
I am creating an ob
Hi
I am doing an simulation, and I a large proportion of the simulation
time is taken up by memory allocations.
I am creating an object, and storing it in a list of those objects.
essentially:
x <- list()
for (t in 1:500) {
x[1] <- new("track")
}
I would like to initialize in one go, to avoid
10 matches
Mail list logo