Smart Guy
2011-Aug-29 10:44 UTC
[R] Problem in writing a R data frame to Excel format using RODBC package
Hi Experts,
I was trying to write a data frame which has a header row,
from R to Excel disk file using RODBC ( RODBC_1.3-1) package. I met with an
issue:- If in sqlSave(), I set a parameter "colnames=FALSE" then I
get
first row as header in excel file. If 'colnames=TRUE' then it gives me
first
2 rows as header in excel file.
Actually, according to my understanding, for FALSE it should not
write header row to Excel file and for TRUE it should write a single header
row to Excel.
Data is ok. Problem is with header row.
sqlSave() is in RODBC package.
Kindly, suggest something. I need an option so that whenever I want I can
save header to excel file or else drop the header and can only save data to
Excel.
Thanks and Regards
SmartG
[[alternative HTML version deleted]]
Jeff Newmiller
2011-Aug-29 11:43 UTC
[R] Problem in writing a R data frame to Excel format using RODBC package
I recommend reading the posting guide and providing a reproducible example. --------------------------------------------------------------------------- Jeff Newmiller The ..... ..... Go Live... DCN:<jdnewmil@dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --------------------------------------------------------------------------- Sent from my phone. Please excuse my brevity. Smart Guy <smartguy3k@gmail.com> wrote: Hi Experts, I was trying to write a data frame which has a header row, from R to Excel disk file using RODBC ( RODBC_1.3-1) package. I met with an issue:- If in sqlSave(), I set a parameter "colnames=FALSE" then I get first row as header in excel file. If 'colnames=TRUE' then it gives me first 2 rows as header in excel file. Actually, according to my understanding, for FALSE it should not write header row to Excel file and for TRUE it should write a single header row to Excel. Data is ok. Problem is with header row. sqlSave() is in RODBC package. Kindly, suggest something. I need an option so that whenever I want I can save header to excel file or else drop the header and can only save data to Excel. Thanks and Regards SmartG [[alternative HTML version deleted]] _____________________________________________ R-help@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. [[alternative HTML version deleted]]
Smart Guy
2011-Aug-29 12:54 UTC
[R] Problem in writing a R data frame to Excel format using RODBC package
Hi All,
Here is the short description of my problem.>mydata ###my data.frame
age height weight
12 97 30
14 95 32
17 120 50
I used a following method from RODBC package. ver 1.3.1, to save as excel
file.
sqlSave(channel,* mydata*, tablename="Sheet1", *colnames = TRUE*)
I got two header rows in Excel file:-
age height weight
age height weight
12 97 30
14 95 32
17 120 50
I need one row if parameter *colnames = TRUE* and no header rows if *
colnames=FALSE*. And actually it should work like this.
If any one came across same issue, kindly help me.
-Thanks
SmartG
On 29 August 2011 16:14, Smart Guy <smartguy3k@gmail.com> wrote:
> Hi Experts,
> I was trying to write a data frame which has a header row,
> from R to Excel disk file using RODBC ( RODBC_1.3-1) package. I met with an
> issue:- If in sqlSave(), I set a parameter "colnames=FALSE"
then I get
> first row as header in excel file. If 'colnames=TRUE' then it gives
me first
> 2 rows as header in excel file.
> Actually, according to my understanding, for FALSE it should
> not write header row to Excel file and for TRUE it should write a single
> header row to Excel.
> Data is ok. Problem is with header row.
>
> sqlSave() is in RODBC package.
>
> Kindly, suggest something. I need an option so that whenever I want I can
> save header to excel file or else drop the header and can only save data to
> Excel.
>
> Thanks and Regards
> SmartG
>
--
SmartG
[[alternative HTML version deleted]]