[R] Cannot write a dataframe to xls or csv Windows 7

William Dunlap wdunlap at tibco.com
Thu Sep 13 23:58:47 CEST 2012


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf
> Of R. Michael Weylandt
> Sent: Thursday, September 13, 2012 2:52 PM
> To: pmulonge
> Cc: r-help at r-project.org
> Subject: Re: [R] Cannot write a dataframe to xls or csv Windows 7
> 
> On Thu, Sep 13, 2012 at 4:05 PM, pmulonge
> <research at namibia.pharmaccess.org> wrote:
> > Hello,
> > I have  a similar issue , but in my case I am using Windows 7
> > i try the following command to write a dataframe to xls using the
> > xlsReadWrite package or the write.csv function
> > write.xls(DATA,'Reg_IDcleaned.xls')
> > or I will write.csv replacin the suffix with .csv
> > I get absolutely no error message and the setwd appears at top of my code
> > with absolute path

Immediately after the write.xls(..., file="something") run
   normalizePath("something", mustWork=TRUE)
and it should give a full path to the file called "something".

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com

> > However when I look in the relevant folder ,the xls or cdv outfile is
> > nowhere to be found.
> > Is there a gremlin in the computer or what?
> 
> It seems unlikely, but I suppose it can't be ruled out....
> 
> > Before, this write.xls was working fine and now it stopped, i used the
> > write.csv to test if it was an error in the package.
> > So since write.csv also fails to produce the oufile in .csv in the relevant
> > folder, I am at my witts end
> >
> 
> Firstly, please do quote context: most of us don't read nabble and I
> have no idea what "similar problem" you're having. (Well, actually, I
> clicked the link and I do, but I'm not letting on) Secondly, can you
> whip up a reproducible example?
> 
> http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-
> example
> 
> I see no reason why
> 
> setwd("~") # Replace with appropriate Windows-ism
> write.csv(data.frame(1:5, letters[1:5]))
> 
> wouldn't work if you have the right permissions, but perhaps you are
> doing something funny.
> 
> Cheers,
> Michael
> 
> ______________________________________________
> 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.




More information about the R-help mailing list