[R] writing output directly to file; sink?

jim holtman jholtman at gmail.com
Mon Mar 26 22:42:15 CEST 2012


'sink' would probably not help since it is just capturing output to
the console and you are still doing the binary to character
conversion.  'save' helps to avoid that.  You might want to see if
there is any difference with using compression (which I think is the
default for 'save') as opposed to writing directly.  This is a time
vs. space tradeoff and with the size of your object, you may want
compression, but try it and see if it makes a difference.

On Mon, Mar 26, 2012 at 4:08 PM, Diann Prosser <dprosser at usgs.gov> wrote:
> Thank you, Jim! I was just trying this as you wrote. Testing it on a small
> sample - it seems to work!
> I am curious - I removed the data that was stored in memory (using rm()),
> and checked to see that it was gone using ls() - and it was; but I didn't
> see a concurrent reduction in the Memory Usage on my Performance Window. Did
> the rm() actually free up memory (it didn't seem to)?
>
> Many thanks for your response!
>
> PS - for any interested, the sink function did not help. My vector was
> longer that what is printed, so when I checked the file, only part of the
> data was there. But save definitely seems to be the way to go here.
>
> --
> View this message in context: http://r.789695.n4.nabble.com/writing-output-directly-to-file-sink-tp4506432p4507059.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.



-- 
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.



More information about the R-help mailing list