Just wondering how come read.table lets you specify fill=TRUE for ragged arrays, but so far as I can tell, no equivalent for write.table? Not a big deal, since I'm perfectly comfortable w/ write and scan and the other file I/O goodies. "A foolish inconsistency..." and all that. Carl
write.table vs. read.table and the argument "fill"
4 messages · Joshua Wiley, David Winsemius, Carl Witthoft
Hi Carl, What would the "equivalent" argument for write.table do? Or perhaps to rephrase my question what type of R object do you have in mind to write that is a "ragged array"? Josh
On Sat, May 7, 2011 at 7:38 AM, Carl Witthoft <carl at witthoft.com> wrote:
Just wondering how come read.table lets you specify fill=TRUE for ragged arrays, but so far as I can tell, no equivalent for write.table? Not a big deal, since I'm perfectly comfortable w/ write and scan and the other file I/O goodies. ?"A foolish inconsistency..." ?and all that. Carl
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Joshua Wiley Ph.D. Student, Health Psychology University of California, Los Angeles http://www.joshuawiley.com/
On May 7, 2011, at 10:38 AM, Carl Witthoft wrote:
Just wondering how come read.table lets you specify fill=TRUE for ragged arrays, but so far as I can tell, no equivalent for write.table?
I imagine the answer is something along the lines of ....read.table creates a rectangular structure and write.table outputs a rectangular structure, so they are congruent. If I wanted to accomplish writing a ragged list I would consider using lapply , paste, and writeLines.
Not a big deal, since I'm perfectly comfortable w/ write and scan and the other file I/O goodies. "A foolish inconsistency..." and all that.
David Winsemius, MD West Hartford, CT
Well, it could be a list variable. foo<- 1:7 bar<-1:9 rab<-list(foo,bar) I suppose I could do something like oof<-rbind(foo,bar) write.table(oof) #ignore the warnings and then ignore or delete the redundant items in the output file.
On 5/8/11 1:51 AM, Joshua Wiley wrote:
Hi Carl, What would the "equivalent" argument for write.table do? Or perhaps to rephrase my question what type of R object do you have in mind to write that is a "ragged array"? Josh On Sat, May 7, 2011 at 7:38 AM, Carl Witthoft<carl at witthoft.com> wrote:
Just wondering how come read.table lets you specify fill=TRUE for ragged arrays, but so far as I can tell, no equivalent for write.table? Not a big deal, since I'm perfectly comfortable w/ write and scan and the other file I/O goodies. "A foolish inconsistency..." and all that.