write.xlsx

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

write.xlsx

Paul Anthony Frontéri
Hey.

I am trying to append a sheet to an existing file using write.xlsx, see
code under:

write.xlsx(x = data1,file = filename,sheetName = "data1", asTable = FALSE,
col.names = T,row.names = F,append = F)
write.xlsx(x = data2,file = filename,sheetName = "data2", asTable = FALSE,
col.names = T,row.names = F,append = T)

However, when using the last line does it not append it to the file, but
overwrite the file. Meaning that the file, which I have have called:

filename <- "test.xlsx"

only includes one sheet - data2. The first data sheet is not there. Why
does not append work with write.xlsx?

Paul

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: write.xlsx

Michael Dewey-3
Dear Paul

Have you defined a variable T or F somewhere?
Rather than look to find out why not replace T by TRUE and F by FALSE
and see if that solves your problem.

On 10/03/2017 07:58, Paul Anthony Frontéri wrote:

> Hey.
>
> I am trying to append a sheet to an existing file using write.xlsx, see
> code under:
>
> write.xlsx(x = data1,file = filename,sheetName = "data1", asTable = FALSE,
> col.names = T,row.names = F,append = F)
> write.xlsx(x = data2,file = filename,sheetName = "data2", asTable = FALSE,
> col.names = T,row.names = F,append = T)
>
> However, when using the last line does it not append it to the file, but
> overwrite the file. Meaning that the file, which I have have called:
>
> filename <- "test.xlsx"
>
> only includes one sheet - data2. The first data sheet is not there. Why
> does not append work with write.xlsx?
>
> Paul
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

--
Michael
http://www.dewey.myzen.co.uk/home.html

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: write.xlsx

Peter Dalgaard-2
Also, this is from a package. Which? (AFAIR, there are at least two possibilities). What is is the docs? Does it even allow an append= argument?

-pd



> On 10 Mar 2017, at 14:49 , Michael Dewey <[hidden email]> wrote:
>
> Dear Paul
>
> Have you defined a variable T or F somewhere?
> Rather than look to find out why not replace T by TRUE and F by FALSE and see if that solves your problem.
>
> On 10/03/2017 07:58, Paul Anthony Frontéri wrote:
>> Hey.
>>
>> I am trying to append a sheet to an existing file using write.xlsx, see
>> code under:
>>
>> write.xlsx(x = data1,file = filename,sheetName = "data1", asTable = FALSE,
>> col.names = T,row.names = F,append = F)
>> write.xlsx(x = data2,file = filename,sheetName = "data2", asTable = FALSE,
>> col.names = T,row.names = F,append = T)
>>
>> However, when using the last line does it not append it to the file, but
>> overwrite the file. Meaning that the file, which I have have called:
>>
>> filename <- "test.xlsx"
>>
>> only includes one sheet - data2. The first data sheet is not there. Why
>> does not append work with write.xlsx?
>>
>> Paul
>>
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>> 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.
>>
>
> --
> Michael
> http://www.dewey.myzen.co.uk/home.html
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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.

--
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: [hidden email]  Priv: [hidden email]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.