[R] Trouble retrieving data (.xls) from folder on my computer.

David Winsemius dwinsemius at comcast.net
Thu Oct 29 15:28:10 CET 2009


On Oct 29, 2009, at 9:36 AM, tobiasfa wrote:

>
> Using gdata on windows and im having trouble to retrieve an excel  
> file from a
> folder on my computer.
>
> This is my dummy:
> R > download.file("http://people.su.se/~lundh/data/cpi_kpix.rda",
> + "cpi_kpix.rda")
>
> R > URL <- "http://people.su.se/"
> R > PATH <- "~lundh/data/"
> R > FILE <- "cpi_kpix.rda"
> R > download.file(paste(URL,PATH,FILE,sep=""),
> + "cpi_kpix.rda")
>
> R > library(gdata)
> R > FILE <- "Stock_Returns_1931_2002.xls"
> R >
> Downloading...
> Done.
> Converting xls file to csv file... Done.
> Reading csv file... Done.
>
> Im not suppose to download the file though its already on my  
> computer. How
> do i type in the path så R finds my .xls??

It's probably not where you think it is. Try using:

stock.xls <- read.xls(file.choose(),  header = TRUE)[, 3:4]

... and navigating your directory tree.
>
--

David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list