Skip to content
Prev 31484 / 398506 Next

List of lists? Data frames? (Or other data structures?)

Try str(aaa) after running scan() and read.table():

scan() returns a list of vectors, while read.table() returns a data frame.
The extra time taken by read.table() (in my tries read.table is 1.2-1.5
times slower than scan, consistent with your numbers) must be due to
binding the vectors into a data frame (checking that they have the same
length, etc). 
In my runs trying to convert the result of scan() into a data frame (with
as.data.frame(aaa)) took about the same time as read.table(), so if you
want a data frame in the end, read.table() may be best.

Aleksey
On Thu, 1 May 2003, R A F wrote: