A few packages have support for basic download from Yahoo Finance. If that's 
what you are trying to achieve - you may want to try quantmod (getSymbols 
function) or tseries (get.hist.quote function). If you want to do something not 
supported yet - first take a look at their source code.

Regards,
Ivan

> From: k...@csusb.edu
> Date: Tue, 12 Jan 2010 22:25:17 -0800
> To: r-help@r-project.org
> Subject: Re: [R] Dynamic file / url name with read.csv
> 
> 
> A few suggestions:
>   Don't mix ' and "
>   Use paste()
>   Don't include an extraneous ;
> 
> SymA<- "SPY"
> Sym1<- 
> paste("http://ichart.finance.yahoo.com/table.csv?s=",SymA,"&ignore=.csv",sep="";)
> Symbol<- read.csv(Sym1, stringsAsFactors=F)
> 
> 
> On Jan 12, 2010, at 10:03 PM, B S wrote:
> > 
> > Hi- 
> > 
> > I would like to be able to change the value of SymA below and download a 
> > file from the corresponding URL.  Hardcoded, this line works fine: 
> > 
> > Symbol<- 
> > read.csv("http://ichart.finance.yahoo.com/table.csv?s=SPY&ignore=.csv";, 
> > stringsAsFactors=F)
> > 
> > However, when I incorporate using a variable for the ticker, it no longer 
> > works.  
> > 
> > SymA<- "SPY"
> > Sym1<- 
> > cat('http://ichart.finance.yahoo.com/table.csv?s=",SymA,"&ignore=.csv",sep="";;)
> > Symbol<- read.csv(Sym1, stringsAsFactors=F)
> > 
> > I know that the problem lies in the concatenation, but I've tried different 
> > variations of cat() and toString() (and others) with SymA and Sym1 but 
> > cannot seem to get a string together that will work.  Would appreciate any 
> > suggestions for this simple problem?? 
> > 
> > Thank you. 
> > 
> > 
> > 
> > 
> > ______________________________________________
> > R-help@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.
> 
> ______________________________________________
> R-help@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.
                                          
_________________________________________________________________


        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to