[R] Allocation of memory to a data frame

From: santosh <santosh.srinivas_at_gmail.com>
Date: Wed, 20 Apr 2011 00:46:50 -0700 (PDT)


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.



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 20 Apr 2011 - 07:48:32 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 20 Apr 2011 - 08:40:32 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive