I started to learn the R language, but I didn't suceed to use an external file. Let say that I have an excel file called "test1.xls" in the directory "C:/program files/R/rw2000/external_files" that looks like that: name mark yair 80 yosi 70 ... In the appropriate directory I wrote this: x<-read.delim("test1.xls") or this: x<-read.csv("test1.xls") but I got: [1] X...... <0 rows> (or 0-length row.names) way cannot I read the file? what is the appropriate command for reading an excel file? I looked at the site of R-project but I didn't find a suitable comand. __________________________________________________ [[alternative HTML version deleted]]
Yayira har wrote:> I started to learn the R language, but I didn't suceed to use an external file. > > Let say that I have an excel file called "test1.xls" in the directory > "C:/program files/R/rw2000/external_files" that looks like that: > > name mark > yair 80 > yosi 70 ... > > In the appropriate directory I wrote this: > > x<-read.delim("test1.xls") > > or this: > > x<-read.csv("test1.xls") > > but I got: > > [1] X...... > <0 rows> (or 0-length row.names) > > way cannot I read the file? what is the appropriate command for reading an excel file? > > I looked at the site of R-project but I didn't find a suitable comand. > > __________________________________________________ > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html >Hi Yayiya, R looks less than fondly on Excel files. The easiest solution for you will be to export your Excel file to a tab-delimited text format (Save -> (.txt) Tab-delimited Text), and then use read.delim as you did. Does that make sense? Kevin
Yayira har wrote:> I started to learn the R language, but I didn't suceed to use an external file. > > Let say that I have an excel file called "test1.xls" in the directory > "C:/program files/R/rw2000/external_files" that looks like that: > > name mark > yair 80 > yosi 70 ... > > In the appropriate directory I wrote this: > > x<-read.delim("test1.xls") > > or this: > > x<-read.csv("test1.xls") > > but I got: > > [1] X...... > <0 rows> (or 0-length row.names) > > way cannot I read the file? what is the appropriate command for reading an excel file? > > I looked at the site of R-project but I didn't find a suitable comand. >Is the file an Excel file (probably from the extension) or can you open the file in notepad and read the text? If not, you need to save the file as csv or txt from within Excel and import the file into R as you tried above. You may also want to read the "R Data Import/Export" manual which is available from the r-project.org website. --sundar
Take a look at the `R Data Import/Export' manual. Hint: if test1.xls is an Excel worksheet, it is not a tab-delimited file. On Tue, 12 Oct 2004, Yayira har wrote:> I started to learn the R language, but I didn't suceed to use an external file. > > Let say that I have an excel file called "test1.xls" in the directory > "C:/program files/R/rw2000/external_files" that looks like that: > > name mark > yair 80 > yosi 70 ... > > In the appropriate directory I wrote this: > > x<-read.delim("test1.xls") > > or this: > > x<-read.csv("test1.xls") > > but I got: > > [1] X...... > <0 rows> (or 0-length row.names) > > way cannot I read the file? what is the appropriate command for reading an excel file? > > I looked at the site of R-project but I didn't find a suitable comand. > > __________________________________________________ > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.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, On Tue, 12 Oct 2004, Kevin Bartz wrote:> R looks less than fondly on Excel files. The easiest solution for you > will be to export your Excel file to a tab-delimited text format (Save > -> (.txt) Tab-delimited Text), and then use read.delim as you did. Does > that make sense?The alternative (tricky but more convinient in the long run) is to use the read.xls() function from gregmisc bundle. Cheers, Kevin -------------------------------- Ko-Kang Kevin Wang PhD Student Centre for Mathematics and its Applications Building 27, Room 1004 Mathematical Sciences Institute (MSI) Australian National University Canberra, ACT 0200 Australia Homepage: http://wwwmaths.anu.edu.au/~wangk/ Ph (W): +61-2-6125-2431 Ph (H): +61-2-6125-7407 Ph (M): +61-40-451-8301