-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
Calling read.csv.raw will fail if all rows are skipped and if colClasses are absent. The built-in function utils::read.csv after which the interface of the really great and fast iotools::read.csv.raw is modelled, does not fail. Would it be possible to catch this admittedly special case which, in my case, would make programming a bit easier?
Many thanks,
Daniel
A short reproducible example:
packageVersion("iotools") # ‘0.2.3’
x <- matrix(sample(100), ncol = 10)
write.csv(x, file = "test.csv", row.names = FALSE)
read.csv("test.csv", skip = 10) # dim == c(0, 11)
read.csv("test.csv", skip = 10, colClasses = rep("integer", 10)) # dim == c(0, 11)
read.csv.raw("test.csv", skip = 10) # Error in subset[, i] : subscript out of bounds
read.csv.raw("test.csv", skip = 10, colClasses = rep("integer", 10)) # dim == c(0, 11)
unlink("test.csv")By the way, I prefer the real/expected column names which are returned by read.csv.raw whenever colClasses are specified compared to the unexpected column names returned by read.csv ('X' concatenated with the values of the last and here skipped line [-- instead of "The default is to use "V" followed by the column number" quoting ?read.csv]).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels