[R] Any way to get read.table.ffdf() (in the ff package) to pass colClasses or comment.char parameters through to read.fwf() ?

Jan jwijffels at bnosac.be
Mon Sep 17 20:58:06 CEST 2012


Hi Anthony,

You are right, read.table.ffdf does not handle additional arguments passed
on to read.table in the method read.fwf as you expect. read.table.ffdf
checks the arguments of read.fwf and colClasses is not one of them,
colClasses is part of ... which is passed on to read.table.
You should report this to the package author. A way on how to circumvent it
is by using the following code after which read.fwf will work as you expect
it with arguments comment.char and colClasses.

read.fwf.default <- get("read.fwf")
read.fwf <- function(file, widths, header = FALSE, sep = "\t", skip = 0,
row.names, col.names, n = -1, buffersize = 2000, comment.char = "#",
colClasses = NA, ...){
  read.fwf.default(file=file, widths=widths, header=header, sep=sep,
skip=skip, row.names=row.names, col.names=col.names, n=n,  
buffersize=buffersize, comment.char = comment.char, colClasses = colClasses,
...)
}
v <- read.table.ffdf(file=fwffile, FUN="read.fwf", widths=c(1,2,3),
colClasses = 'factor')


hope this helps,
Jan



--
View this message in context: http://r.789695.n4.nabble.com/Any-way-to-get-read-table-ffdf-in-the-ff-package-to-pass-colClasses-or-comment-char-parameters-throu-tp4643171p4643413.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list