Skip to content

sink() does not seem to release the file

3 messages · BXC (Bendix Carstensen), Peter Dalgaard, Brian Ripley

#
I run Win2000, and when I try to write to a file and later use it
it seems that R 1.02.0 has a firm grip on it:
_              
platform i386-pc-mingw32
arch     x86            
os       Win32          
system   x86, Win32     
status                  
major    1              
minor    2.0            
year     2000           
month    12             
day      15             
language R
some text
Volume in drive N is Local Disk
 Volume Serial Number is 1C5E-3A70

 Directory of N:\Bendix\Steno\JaSv\iddm

02-01-2001  11:33                    9 foo
               1 File(s)              9 bytes
               0 Dir(s)  172.857.344.000 bytes free
N:\Bendix\Steno\JaSv\iddm\foo
The process cannot access the file because it is being used by another
process.


However, when I fire up my old R 1.01.1 (which is not installed under
Win2000,
but merely a verbatim copy from my old NT4 machine), I get:
_         
platform Windows   
arch     x86       
os       Win32     
system   x86, Win32
status             
major    1         
minor    1.1       
year     2000      
month    August    
day      15        
language R
any text
Volume in drive N is Local Disk
 Volume Serial Number is 1C5E-3A70

 Directory of N:\Bendix\Steno\JaSv\iddm

02-01-2001  11:37                    8 oof
               1 File(s)              8 bytes
               0 Dir(s)  172.857.339.904 bytes free
Volume in drive N is Local Disk
 Volume Serial Number is 1C5E-3A70

 Directory of N:\Bendix\Steno\JaSv\iddm

File Not Found
Warning message: 
cmd execution failed with error code 1 in: shell("dir oo*")
Is this a new bug or a new facility??

I have a vague recollection that a similar problem was also present in an
older version of R, too.
The workaround in R 1.2 is to:
and then use oof for the relevant purpose.

The background for this is that I use R to write a small SAS-program
that writes a SAS-dataset in a read.table format, that I then read into
R. But when strted from withn R, SAS complains that the program file just 
sink()ed by R is in use (apparently by R). 

Any one interested can get the rather clumsy sas.get.R and the corresponding
%out SAS-macro from me on request. Requires that SAS is on your macine 
as well. No bells and whistles at all.

Bendix Carstensen

----------------------
Bendix Carstensen
Senior Statistician
Steno Diabetes Centre
Niels Steensens Vej 2
DK-2820 Gentofte
Denmark
tel: +45 44 43 87 38
mob: +45 28 25 87 38
fax: +45 44 43 73 13
bxc at novo.dk
www.biostat.ku.dk/~bxc
----------------------




-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
"BXC (Bendix Carstensen)" <bxc at novonordisk.com> writes:
[Proof deleted]

This was on the R-devel list 2 weeks ago:
On Tue, 19 Dec 2000, Prof Brian D Ripley wrote:

            

  
    
#
To add to that, this behaviour has been changed in the R-patched version
(and hence for 1.2.1): from NEWS/BUG FIXES

    o   Explicitly close files opened by sink() for OSes (such as
        Windows) that benefit from it.

In other words, sink() will close the connection for you.
On 2 Jan 2001, Peter Dalgaard BSA wrote: