Good afternoon, I would like to know how can I import Excel files in R ? Do I have to transform them in text files (.txt) ? Thank you Emilie Haon-Lasportes
If you want to just import the data and go, saving as a .csv file and using read.csv (something like this) is the way to go. If you are using a real-time file (open) or using a large excel file, you may want to look at RODBC. While this is a little harder to figure out, it allows one to use SQL queries to retrieve the data needed from excel and prevent overburdening R with data. Shawn Way, PE Engineering Manager sway at tanox.com -----Original Message----- From: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Emilie Haon.Lasportes Sent: Tuesday, April 20, 2004 9:29 AM To: R-help at stat.math.ethz.ch Subject: [R] import Excel file ? Good afternoon, I would like to know how can I import Excel files in R ? Do I have to transform them in text files (.txt) ? Thank you Emilie Haon-Lasportes ______________________________________________ R-help at stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> > Good afternoon, > > I would like to know how can I import Excel files in R ? Do I have to > transform them in text files (.txt) ? > Thank youHello Emilie, two possibilities come to my mind: 1) Save your execl file as csv and use read.csv() 2) Use the contributed package "RODBC" library(RODBC) chan <- odbcConnectExcel("Path to your Excel file") your.df <- sqlFetch(chan, "name of your data sheet") close(chan) and of course, last but not least, consult the manual: R Data Import/Export HTH, Bernhard> > Emilie Haon-Lasportes > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html >-------------------------------------------------------------------------------- The information contained herein is confidential and is inte...{{dropped}}
Emilie Haon.Lasportes <Emilie.Haon-Lasportes <at> beaulieu.rennes.inra.fr> writes:> I would like to know how can I import Excel files in R ? Do I have to > transform them in text files (.txt) ?The easiest way for one time use is to select the data in Excel, press ctrl-c to copy it to the clipboard and then use the following R command: read.table("clipboard", header=T) (assuming the first selected line is the header).
You can also find different examples in the manual R for Beginners by Emmanuel Paradis (that you can easily download from the internet) under http://zoonek2.free.fr/UNIX/48_R/all.html you find a lot of information about R in french, which is also very useful Mike --- --- --- ---