[R] Re: none

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Wed Dec 6 12:37:50 CET 2000


HAKIM Nour-Eddine <noureddine.hakim at axa-corporatesolutions.com> writes:

> Dear ,
> 
> I want to import Excel data (.XLS). Can you help me to this.
> 

It's difficult without going via a text file, so you need to have
Excel on the machine. This is what I have been telling students
(part of the information is described for SPSS, so you get that as
well):

\item[SPSS:] Use |File, Export| menu in the data editor and export as
  a tab-separated file (for simplicity, say |mydata.txt| in the top
  directory on the |C:| drive). Make sure that it contains a header
  line with the variable names and use
  |read.csv2("C:/mydata.txt",sep="\t")| to read it in. This refers to
  locales where the comma is used as decimal separator, otherwise use
  |read.csv|.
  
  Alternatively, one can copy the data or a section of it directly to
  a text editor such as Notepad via the Windows copy and paste
  mechanism.  Note however that the variable names are not copied in
  this way, so one must either add them by hand (recommended) or use
  |read.csv2("C:/mydata.txt",sep="\t",header=F)| and add variable
  names later.


\item[Excel:] Use |File,Save as...| and choose tab-sep (|.txt|) or use
  the clipboard.  Subsequent data handling is similar to SPSS. Note
  that a header line will only be present if it was in the spreadsheet
  to begin with.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list