[R] IMPORTING FILE FROM EXCEL

Peter Dalgaard p.dalgaard at biostat.ku.dk
Tue Jul 4 15:03:42 CEST 2006


"John Sorkin" <jsorkin at grecc.umaryland.edu> writes:

> Rashmi,
> I suggest you store the file as a comma separated file (.CSV). You can
> import a .csv file using the read.csv function
> data<-read.csv("d:\\myfile.csvl")
> I suggest you look at the help file for read.csv, i.e.
> help(read.csv)

Sorry, but this doesn't make sense. read.delim() reads tab-separated
files just as easily as read.csv() reads comma-separated ones (and in
both cases, there is a "2" variant for locales in which comma is used
as decimals separator as in 0,02 EUR).

As others have pointed out, the real issue was how to specify a
filename, and the use of the backslash escape. And Duncan M. pointed
towards file.choose() as a user-friendly helper on Windows.

> John
> 
> John Sorkin M.D., Ph.D.
> Chief, Biostatistics and Informatics
> Baltimore VA Medical Center GRECC,
> University of Maryland School of Medicine Claude D. Pepper OAIC,
> University of Maryland Clinical Nutrition Research Unit, and
> Baltimore VA Center Stroke of Excellence
> 
> University of Maryland School of Medicine
> Division of Gerontology
> Baltimore VA Medical Center
> 10 North Greene Street
> GRECC (BT/18/GR)
> Baltimore, MD 21201-1524
> 
> 410-605-7119
> jsorkin at grecc.umaryland.edu
> 
> >>> Rashmi Pant <rashmi6380 at yahoo.co.uk> 07/04/06 2:22 AM >>>
> Hi 
>   I am a beginner with R.
>   I have been trying to import a tab delimited excel file but i get the
> following error message
>   > file.show('C:\Documents and
> Settings\stats\Desktop\SUMI\plasma2.txt')
> Warning message:
> file.show(): file 'C:Documents and SettingsstatsDesktopSUMIplasma2.txt'
> does not exist 
>  I have understood the programming part but i cannot go ahead unless i
> have imported the file. I have consulted the R-help archive without
> success.
>   Any help will be appreciated
>   Thanks in advance
> 
>  		
> ---------------------------------
> 
> 	[[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
> 
> ______________________________________________
> 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
> 

-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907



More information about the R-help mailing list