Data.table: [R-Forge #2622] Add command "fwrite" to faster save csv files

Created on 8 Jun 2014  路  18Comments  路  Source: Rdatatable/data.table

Submitted by: Ma Jom; Assigned to: Nobody; R-Forge link

I really love the new command "fread" as it really speeds up the work with large files. It would be great to see a corresponding command for writing CSV files.

Currently, I use a combination of write.csv and as.matrix to speed up this process a bit:
http://stackoverflow.com/questions/10505605/speeding-up-the-performance-of-write-table

feature request fwrite

Most helpful comment

@oseiskar @smartinsightsfromdata Sorry I didn't see your comments above in Oct or Nov at the time. Of course (!) we would be delighted to accept PR. But I already wrote above in Oct 2014 that "Contributions are more than welcome" in case that was not already clear, so I don't know why you asked rather than just submitting the PR.
Maybe it was because of our fears expressed above that the effort would be wasted. You may be better off contributing to the so called Hadley-verse since that is what most people (well, on twitter and blogs anyway) jump up and down about. Hadley has the midas touch if that's what you want. But if you wanted to contribute fwrite to data.table, of course it would be accepted. Or create your own new package of course.

All 18 comments

Is this in the works? I am dealing with the same problem

@abfleishman @robbyjo We're not working on it currently. Contributions are more than welcome and I'm happy to guide anyone on how to do it. Or, funding would help a lot.

I agree, data.table is missing a fwrite functionality.
It would be a great addition.

+1 for fwrite function

+1 for fwrite function

I would also really appreciate an fwrite function!

Of course I'm all in for this.

At this point, as I briefly touched upon during UseR 2015, there's no motivation or incentive to implement fwrite for neither of us. To implement it efficiently is a lot of work, and it comes out of our free time. With the possibility of it being just _reimplemented_ as well in another package (like readr) at some point in time, it doesn't seem like a good investment of our time.

If anyone else is interested in investing their time, please feel free to contact us.

We have developed a faster function for writing CSV files and achieved > 2x speedups (on a 64-bit Windows machine with an SSD) See this Gist for a proof of concept. I can start working on a pull request with more features if you are interested.

@oseiskar code seems very promising.
@mattdowle @arunsrinivasan would you consider a pr for a fwrite on this basis?

Not having fwrite to complement fread is like not having write.csv to complement read.csv (or write.table/read.table)

+1 for fwrite function

+1 for fwrite function

@oseiskar @smartinsightsfromdata Sorry I didn't see your comments above in Oct or Nov at the time. Of course (!) we would be delighted to accept PR. But I already wrote above in Oct 2014 that "Contributions are more than welcome" in case that was not already clear, so I don't know why you asked rather than just submitting the PR.
Maybe it was because of our fears expressed above that the effort would be wasted. You may be better off contributing to the so called Hadley-verse since that is what most people (well, on twitter and blogs anyway) jump up and down about. Hadley has the midas touch if that's what you want. But if you wanted to contribute fwrite to data.table, of course it would be accepted. Or create your own new package of course.

fwrite PR merged! Thanks @oseiskar !!

Just took the liberty of updating the SO "fast writing" post linked at the head of this thread.

Some more clean-up: @mattdowle you mention the lack of fwrite in this answer, not sure if you prefer to update yourself

Thanks @MichaelChirico. Please do go ahead and update my answers too - I don't mind at all as it saves time. Thanks! Nice detailed answer btw with extensive benchmark.

Work on fwrite continued here: #1664

Was this page helpful?
0 / 5 - 0 ratings

Related issues

arunsrinivasan picture arunsrinivasan  路  3Comments

st-pasha picture st-pasha  路  3Comments

sbudai picture sbudai  路  3Comments

sengoku93 picture sengoku93  路  3Comments

jangorecki picture jangorecki  路  3Comments