[R] excel files and R

Pfaff, Bernhard Bernhard.Pfaff at drkw.com
Wed Jun 25 10:55:20 CEST 2003


> 
> There's a function odbcConnectExcel, a wrapper to odbcDriverConnect.
> Neither require any work with Windows menus.
> 
Try the following sample script and save it as "foo.R":

library(RODBC)
chan1 <- odbcConnectExcel("your-file.xls")
aa <- sqlFetch(chan1, "Name of your sheet")
names(aa)
close(chan1)

as batch:
Rterm --no-restore --no-save < foo.R

works for me, at least.


HTH,
Bernhard




> On Wed, 25 Jun 2003, Simon Fear wrote:
> 
> > RODBC works fine but as far as I can tell requires that the 
> connection
> > be
> > opened through Windows menus. OK for a one-off, but not for batch
> > processing.
> > Please someone tell me what I missed - how can I open the connection
> > within
> > an R script?
> > (Windows 98)(not my fault)
> > 
> > TIA
> >  (sorry for long disclaimer, can't switch it off)
> > 
> > -----Original Message-----
> > From: Prof Brian Ripley [mailto:ripley at stats.ox.ac.uk]
> > Sent: 24 June 2003 17:54
> > To: Victor H. Marím
> > Cc: r-help at stat.math.ethz.ch
> > Subject: Re: [R] excel files and R
> > 
> > 
> > Security Warning:
> > If you are not sure an attachment is safe to open please contact 
> > Andy on x234. There are 0 attachments with this message.
> > ________________________________________________________________
> > 
> > On Tue, 24 Jun 2003, Victor H. Marím wrote:
> > 
> > > I am new at R.  My questions is rather basic.  Looking R 
> manuals looks
> > > like there should be a way to read MS excel files into R.  Could
> > > somebody tell me which library should I use for that?
> > 
> > Several ways are in the R Data Import/Export Manual (the 
> obvious manual,
> > I
> > would have thought).  If you are working on Windows, using RODBC is
> > perhaps the simplest.
> > 
> > 
> 
> -- 
> Brian D. Ripley,                  ripley at stats.ox.ac.uk
> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> University of Oxford,             Tel:  +44 1865 272861 (self)
> 1 South Parks Road,                     +44 1865 272866 (PA)
> Oxford OX1 3TG, UK                Fax:  +44 1865 272595
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> 


----------------------------------------------------------------------
If you have received this e-mail in error or wish to read our e-mail 
disclaimer statement and monitoring policy, please refer to 
http://www.drkw.com/disc/email/ or contact the sender.




More information about the R-help mailing list