From: Prof Brian Ripley <ripley at stats.ox.ac.uk>
To: Roger Peng <rpeng at stat.ucla.edu>
CC: r-help at stat.math.ethz.ch, R A F <raf1729 at hotmail.com>
Subject: Re: [R] List of lists? Data frames? (Or other data structures?)
Date: Thu, 1 May 2003 08:42:55 +0100 (BST)
On Wed, 30 Apr 2003, Roger Peng wrote:
If you're talking about rows and columns, it seems like the appropriate
data structure for you is the data frame. I think your list of lists
representation might get unwieldy after a while. I can't really think
why a data frame would be any slower than a list of lists -- I've never
experienced such behavior.
read.table() may be a little slower than scan() because read.table()
in an entire file and then converts each of the columns into an
appropriate data class. So there is some post-processing going on. It
doesn't have anything to do with data frames vs. lists.
Only if you don't specify colClasses: if you do (and you would need the
information to use scan()) there should be no performance penalty. (Note
that matrices can be scan()-ed into a vector and the dimensions added, and
that will be faster.)