Re: [R] Odp: export tables to Excel files

2010-02-23 Thread Tal Galili
p.s:

From the post I linked to earlier, I personally am using this code:

# install.packages(RODBC)

library(RODBC)
save2excel - function(x, t.name) sqlSave(xlsFile,
x, tablename = t.name, rownames = FALSE, addPK = T)
xlsFile - odbcConnectExcel(C:\\output-tables.xls, readOnly = FALSE)

temp.df - data.frame(a = rnorm(10), b = runif(10))
temp.df2 - data.frame(a = rnorm(10), b = runif(10))
save2excel(temp.df, test)
save2excel(temp.df2, test2)
odbcCloseAll()





Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Tue, Feb 23, 2010 at 12:11 PM, Petr PIKAL petr.pi...@precheza.cz wrote:

 Hi

 I use this simple statement to produce output readable directly to excel


  write.excel
 function (tab, ...)
 write.table(tab, clipboard, sep = \t, row.names = F)

 If you put a name of a file instead of clipboard then you can use output
 to file and you can use append =TRUE

 See ?write.table for further options. It is not so sophisticated as other
 possibilities but I got used to it and it works.

 Regards
 Petr

 r-help-boun...@r-project.org napsal dne 23.02.2010 10:35:11:

  Dear R users,
 
  I've just posted a similar question about Illustrator.
  This time I would like to export the results of my statistic tables and
  my dataframes into Excel files.
 
  Up to now I've used write.csv(), but I have to resave every file in .xls

  in Excel.
  I would like to know if there is a function or package to export
  directly into *.xls.
 
  I have found xlsReadWrite which would be perfect for me, if only I could

  append data to an existing file (I need to do it) and it doesn't work
  with R2.10 (of course the version I use...).
  Of course, since I would like to export .xls files, I would have to be
  able to read them too, which means that the package WriteXLS wouldn't be

  enough. And in any case, appending data is not possible.
  The package xlsx is not what I need since I still use Excel 2003.
 
  Are there other packages that would correspond to my needs? There might
  also be a better, completely different, approach. I'm open to all
  suggestions of course!
 
  Thanks in advance for your help
  Ivan
 
  __
  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.

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

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


Re: [R] Odp: export tables to Excel files

2010-02-23 Thread Ivan Calandra
Thank you all for your helpful answers
I will probably use the solution below, it seems more flexible.
Ivan

Le 2/23/2010 11:16, Tal Galili a écrit :
 p.s:

 From the post I linked to earlier, I personally am using this code:

 # install.packages(RODBC)

 library(RODBC)
 save2excel - function(x, t.name http://t.name) sqlSave(xlsFile,
 x, tablename = t.name http://t.name, rownames = FALSE, addPK = T)
 xlsFile - odbcConnectExcel(C:\\output-tables.xls, readOnly = FALSE)

 temp.df - data.frame(a = rnorm(10), b = runif(10))
 temp.df2 - data.frame(a = rnorm(10), b = runif(10))
 save2excel(temp.df, test)
 save2excel(temp.df2, test2)
 odbcCloseAll()





 Contact 
 Details:---
 Contact me: tal.gal...@gmail.com mailto:tal.gal...@gmail.com | 
  972-52-7275845
 Read me: www.talgalili.com http://www.talgalili.com (Hebrew) | 
 www.biostatistics.co.il http://www.biostatistics.co.il (Hebrew) | 
 www.r-statistics.com http://www.r-statistics.com (English)
 --




 On Tue, Feb 23, 2010 at 12:11 PM, Petr PIKAL petr.pi...@precheza.cz 
 mailto:petr.pi...@precheza.cz wrote:

 Hi

 I use this simple statement to produce output readable directly to
 excel


  write.excel
 function (tab, ...)
 write.table(tab, clipboard, sep = \t, row.names = F)

 If you put a name of a file instead of clipboard then you can
 use output
 to file and you can use append =TRUE

 See ?write.table for further options. It is not so sophisticated
 as other
 possibilities but I got used to it and it works.

 Regards
 Petr

 r-help-boun...@r-project.org mailto:r-help-boun...@r-project.org
 napsal dne 23.02.2010 10:35:11:

  Dear R users,
 
  I've just posted a similar question about Illustrator.
  This time I would like to export the results of my statistic
 tables and
  my dataframes into Excel files.
 
  Up to now I've used write.csv(), but I have to resave every file
 in .xls

  in Excel.
  I would like to know if there is a function or package to export
  directly into *.xls.
 
  I have found xlsReadWrite which would be perfect for me, if only
 I could

  append data to an existing file (I need to do it) and it doesn't
 work
  with R2.10 (of course the version I use...).
  Of course, since I would like to export .xls files, I would have
 to be
  able to read them too, which means that the package WriteXLS
 wouldn't be

  enough. And in any case, appending data is not possible.
  The package xlsx is not what I need since I still use Excel 2003.
 
  Are there other packages that would correspond to my needs?
 There might
  also be a better, completely different, approach. I'm open to all
  suggestions of course!
 
  Thanks in advance for your help
  Ivan
 
  __
  R-help@r-project.org mailto: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.

 __
 R-help@r-project.org mailto: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]]

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