I am using MS Excel (Windos Operating system), how I import/export data between MS_Excel and R. Regds Faisal Afzal SIddiqui +92-300-9297089 fasidfas at yahoo.com ____________________________________________________________________________________ Never miss a thing. Make Yahoo your home page.
On Wed, 28 Nov 2007, faisal afzal siddiqui wrote:> I am using MS Excel (Windos Operating system), how I > import/export data between MS_Excel and R.Why not read the 'R Data Import/Export' manual? It ships with R, or can be accessed from http://cran.r-project.org/manuals.html . -- 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
Hi r-help-bounces at r-project.org napsal dne 29.11.2007 04:54:18:> I am using MS Excel (Windos Operating system), how I > import/export data between MS_Excel and R.What data and how often. There are few options from add on packages through ODBC to copy and paste. If you bother to read any documentation about R you coud find it easily. Eg. if you know Google you can ask R export data excel and the first hit reveals you one possibility. Regards Petr> > Regds > Faisal Afzal SIddiqui > +92-300-9297089 > fasidfas at yahoo.com > > > >____________________________________________________________________________________> Never miss a thing. Make Yahoo your home page. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code.
The package RODBC by Pr. Ripley is very helpful for this (Thanks To B. Ripley). Also see the package xlsReadWrite (thanks to H.P Suter). The latter is maybe easier to use. Good luck AA. ----- Original Message ----- From: "faisal afzal siddiqui" <fasidfas at yahoo.com> To: <r-help at r-project.org> Sent: Wednesday, November 28, 2007 10:54 PM Subject: [R] MS Excel Data>I am using MS Excel (Windos Operating system), how I > import/export data between MS_Excel and R. > > Regds > Faisal Afzal SIddiqui > +92-300-9297089 > fasidfas at yahoo.com > > > > ____________________________________________________________________________________ > Never miss a thing. Make Yahoo your home page. > > ______________________________________________ > R-help at 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.
This has been discussed on this list many times before. Google on "Import Excel R". Note also that there are potential problems (loss of digits) due to Excel "idiosyncracies" depending on what you do. http://www.burns-stat.com/pages/Tutor/spreadsheet_addiction.html provides some details. Finally, I have found that for rectangular data sets with no missing fields in Excel (tables), cutting and read.tabling **the data only ** is a simple(but probably not without risk) way to do it: (after cutting the data only in Excel to the clipboard) in R: newdat <- read.table("clipboard", head=FALSE, row.names=NULL) The columns can then be named via names(newdat) <- ... I omit column headers because in most of the Excel data I get the column names have spaces and other non-alphanumeric characters which R cannot easily digest. One could separately scan() just the vector of column headers and use regular expressions to extract the names. But for small tables, I find it easier just to create the names manually. Bert Gunter Genentech Nonclinical Statistics -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of AA Sent: Thursday, November 29, 2007 10:30 AM To: faisal afzal siddiqui; r-help at r-project.org Subject: Re: [R] MS Excel Data The package RODBC by Pr. Ripley is very helpful for this (Thanks To B. Ripley). Also see the package xlsReadWrite (thanks to H.P Suter). The latter is maybe easier to use. Good luck AA. ----- Original Message ----- From: "faisal afzal siddiqui" <fasidfas at yahoo.com> To: <r-help at r-project.org> Sent: Wednesday, November 28, 2007 10:54 PM Subject: [R] MS Excel Data>I am using MS Excel (Windos Operating system), how I > import/export data between MS_Excel and R. > > Regds > Faisal Afzal SIddiqui > +92-300-9297089 > fasidfas at yahoo.com > > > >____________________________________________________________________________ ________> Never miss a thing. Make Yahoo your home page. > > ______________________________________________ > R-help at 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 at 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.
On Nov 29, 2007 3:01 PM, Bert Gunter <gunter.berton at gene.com> wrote:> This has been discussed on this list many times before. Google on "Import > Excel R". Note also that there are potential problems (loss of digits) due > to Excel "idiosyncracies" depending on what you do. > http://www.burns-stat.com/pages/Tutor/spreadsheet_addiction.html provides > some details. > > Finally, I have found that for rectangular data sets with no missing fields > in Excel (tables), cutting and read.tabling **the data only ** is a > simple(but probably not without risk) way to do it: > > (after cutting the data only in Excel to the clipboard) in R: > > newdat <- read.table("clipboard", head=FALSE, row.names=NULL) > > The columns can then be named via names(newdat) <- ... > > I omit column headers because in most of the Excel data I get the column > names have spaces and other non-alphanumeric characters which R cannot > easily digest. One could separately scan() just the vector of column headers > and use regular expressions to extract the names. But for small tables, I > find it easier just to create the names manually.You can include headers with spaces in the copy with: DF <- read.delim("clipboard")
Better yet! Thanks Gabor. -- Bert -----Original Message----- From: Gabor Grothendieck [mailto:ggrothendieck at gmail.com] Sent: Thursday, November 29, 2007 12:10 PM To: Bert Gunter Cc: r-help at r-project.org Subject: Re: [R] MS Excel Data On Nov 29, 2007 3:01 PM, Bert Gunter <gunter.berton at gene.com> wrote:> This has been discussed on this list many times before. Google on "Import > Excel R". Note also that there are potential problems (loss of digits) due > to Excel "idiosyncracies" depending on what you do. > http://www.burns-stat.com/pages/Tutor/spreadsheet_addiction.html provides > some details. > > Finally, I have found that for rectangular data sets with no missingfields> in Excel (tables), cutting and read.tabling **the data only ** is a > simple(but probably not without risk) way to do it: > > (after cutting the data only in Excel to the clipboard) in R: > > newdat <- read.table("clipboard", head=FALSE, row.names=NULL) > > The columns can then be named via names(newdat) <- ... > > I omit column headers because in most of the Excel data I get the column > names have spaces and other non-alphanumeric characters which R cannot > easily digest. One could separately scan() just the vector of columnheaders> and use regular expressions to extract the names. But for small tables, I > find it easier just to create the names manually.You can include headers with spaces in the copy with: DF <- read.delim("clipboard")