tobiasfa
2009-Oct-29 13:36 UTC
[R] Trouble retrieving data (.xls) from folder on my computer.
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 > stock.xls <- read.xls(paste(URL, PATH, FILE, sep = ""), + header = TRUE)[, 3:4] 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?? kind regards Tobias -- View this message in context: http://www.nabble.com/Trouble-retrieving-data-%28.xls%29-from-folder-on-my-computer.-tp26113172p26113172.html Sent from the R help mailing list archive at Nabble.com.
David Winsemius
2009-Oct-29 14:28 UTC
[R] Trouble retrieving data (.xls) from folder on my computer.
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
Gabor Grothendieck
2009-Oct-29 14:41 UTC
[R] Trouble retrieving data (.xls) from folder on my computer.
If its already on your computer try one of these: xls <- read.xls("myfile.xls") # if its in current directory xls <- read.xls("/path/to/myfile.xls") # to specify path xls <- read.xls(file.choose()) # use explorer style interface to choose On Thu, Oct 29, 2009 at 9:36 AM, tobiasfa <tobias.farnlycke at gmail.com> 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 > stock.xls <- read.xls(paste(URL, PATH, FILE, sep = ""), > + header = TRUE)[, 3:4] > 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?? > > kind regards Tobias > > -- > View this message in context: http://www.nabble.com/Trouble-retrieving-data-%28.xls%29-from-folder-on-my-computer.-tp26113172p26113172.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org 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. >
Gabor Grothendieck
2009-Oct-30 03:23 UTC
[R] Trouble retrieving data (.xls) from folder on my computer.
Check out the relevant HOWTO here: http://code.google.com/p/batchfiles/#HOWTO On Thu, Oct 29, 2009 at 5:06 PM, tobiasfa <tobias.farnlycke at gmail.com> wrote:> > How do i make sure perl is in my PATH, and if its not how do i put it there? > > > > Either make sure that perl is on your PATH or if the path/filename you > specified is correct then try with backslashes just in case: > > "C:\\perl\\bin\\perl.exe" > > Also check the upper/lower case of each component of your path just in case. > -- > View this message in context: http://www.nabble.com/Trouble-retrieving-data-%28.xls%29-from-folder-on-my-computer.-tp26113172p26120777.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org 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. >