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

R. Michael Weylandt michael.weylandt at gmail.com
Thu Sep 13 23:51:49 CEST 2012


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
> 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




More information about the R-help mailing list