[R] questions on csv reading

"Jens Oehlschlägel" oehl_list at gmx.de
Sat Sep 26 20:36:23 CEST 2009


Hi,

Is there any official way to determine the colClasses of a data.frame?
Why has POSIXct such a strange class structure?
Why is colClasses "ordered" not allowed (and doesn't work)?

Background
==========
I am writing a chunked csv reader that provides the functionality of read.table for large files (in the next version of package ff). In chunked reading, one wants to learn the colClasses from the data.frame returned for the first chunk and submit this as argument colClasses= to the following chunks (following calls to read.table). 

for most column types 
colClasses <- sapply(data.frame, class)
works fine. However, two column types have more than one class: 

"ordered" has c("ordered", "factor") - currently we can't tell read.table that a column is an ordered factor

"POSIXct" has c("POSIXt","POSIXct") - here the LESS specific class "POSIXt" is in the first position and would win in class-dispatch over the MORE specific class "POSIXct". Why?


Jens Oehlschlägel

-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!




More information about the R-help mailing list