Skip to content
Prev 31478 / 398506 Next

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

For what it's worth, I followed the suggestion of using colClasses:

cls <- c( "numeric", "character", "numeric", "numeric", "numeric" )
system.time( bbb <- read.table( "file", colClasses = cls ) )

Here're the results from three tries:
8.21 0.06 8.28 0.00 0.00
8.94 0.10 9.10 0.00 0.00
8.55 0.06 8.69 0.00 0.00

I also did
system.time( aaa <- scan( "file", list( 0, "", 0, 0, 0 ) ) three
times:

6.46 0.04 6.59 0.00 0.00
5.27 0.04 5.33 0.00 0.00
5.14 0.05 5.19 0.00 0.00

By the way, I did the experiment in the order bbb, aaa, bbb, aaa,
bbb, aaa.

So it appears that read.table is still a little slower -- but it could
be just me doing something wrong.

Thanks.