Re: [R] for importing "data"

From: Hans-Peter <gchappi_at_gmail.com>
Date: Mon 30 Oct 2006 - 10:04:25 GMT

Hi,

> *I had an Excel file, then I turned it into a "tab-delimited" file, as
> ...
> lahore<-read.delim("lahore.txt")

I suppose you are on windows, hence you can use the package xlsReadWrite to read the Excelfile directly. It's on the CRAN and you can download it from the RGui under the menu: Packages -> Install package(s)... (select a mirror, download).

Example: lahore <- read.xls( "lahore.xls" )

Gives back the data from the first sheet as a data.frame and assumes that there is a header row. Without header row set the colNames argument to FALSE.

This is a user contributed package and doesn't belong to the core R environment, hence you shouldn't post in this group if need help with it (contact me or much better go to:
http://groups.google.ch/group/supportR). xlsReadWrite is a bit non-standard and currently non-portable. So maybe not appropriate for a novice. On the other hand it is easy to use and no need for csv detours to get your data...

> Error in file(file, "r") : unable to open connection
> In addition: Warning message:
> cannot open file 'lahore.txt', reason 'No such file or directory'

Already answered: ?getwd ?setwd

-- 
Regards,
Hans-Peter

______________________________________________
R-help@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
and provide commented, minimal, self-contained, reproducible code.
Received on Tue Oct 31 03:47:16 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Mon 30 Oct 2006 - 17:30:15 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.