[R] closing file with close(file) *silently*

Sarah Goslee sarah.goslee at gmail.com
Tue Mar 6 19:01:21 CET 2012


The help for warning offers some suggestions.

Sarah

On Tue, Mar 6, 2012 at 12:53 PM, Federico Calboli
<f.calboli at imperial.ac.uk> wrote:
> Hi All,
>
> I am writing a function that reads a file in
>
> myfile = file('myfile.raw', 'rb')
> .
> .
> .
> .
> .
> close(myfile)
>
> No matter what, I get the warning
>
> Warning message:
> closing unused connection 3 (myfile.raw)
>
> Since the whole thing is in a function, I'd like to avoid unecessary noise for the user, and I'd like to kill the warning -- without having to mess with global options.
>
> Any ideas how?
>
> BW
>
> F
>
-- 
Sarah Goslee
http://www.functionaldiversity.org



More information about the R-help mailing list