Skip to content
Back to formatted view

Raw Message

Message-ID: <8e072d65-28a1-4881-9759-655a269eca25@m23g2000prl.googlegroups.com>
Date: 2011-04-20T07:46:50Z
From: Santosh Srinivas
Subject: Allocation of memory to a data frame

Hello gRoup,

A while back I was advised that overallocating an object and filling
it up is better than rbind.

I am trying to optimize some code. I have the following object (empty
which I know in advance).
Is there an easy to create an empty data frame with 100,000 empty rows
based on the structure below?

> dput(d)
structure(list(A = character(0), B = character(0), C = numeric(0),
    D = character(0), E = character(0), F = character(0), G =
character(0),
    H = structure(numeric(0), class = "Date"), I = numeric(0),
    J = integer(0)), .Names = c("A", "B", "C", "D", "E", "F",
"G", "H", "I", "J"), row.names = integer(0), class = "data.frame")

I can use dataFrame in R.utils and do it explicitly but wondering if
there an easier way since I have the structure with me.

Thank you.