[R] R dataframe into a SAS dataset

Roger Bivand Roger.Bivand at nhh.no
Tue Nov 21 13:46:00 CET 2006


On Tue, 21 Nov 2006, Shubha Vishwanath Karanth wrote:

> Hi experts,
> 
>  
> 
> The below is the code I wrote for expoting an R dataframe into a SAS
> data set. I get the below error. So, what is the problem? Could somebody
> help me on this?
> 
>  
> 
> *       write.foreign(x,"Z:\\new","Z:\\new",package="SAS")

> args(write.foreign)
function (df, datafile, codefile, package = c("SPSS", "Stata", 
    "SAS"), ...) 

The datafile and codefile arguments must be different files, one for data, 
the other for the code you will use for reading the data into your target 
software. On Linux for me the codefile overwrites the datafile, but for 
you on Windows(?) the file is still open, so the code writer cannot write 
to it.

> 
>  
> 
> Error in file(file, ifelse(append, "a", "w")) : 
> 
>         unable to open connection
> 
> In addition: Warning message:
> 
> cannot open file 'Z:\new', reason 'Permission denied'
> 
>  
> 
>  
> 
> Thanks u,
> 
> Shubha.
> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no



More information about the R-help mailing list