Possible duplicate:
How to create a variable from sockets?
Run it in R:
require(quantmod) setSymbolLookup(SDB=list(name="000001.sz",src="yahoo")) getSymbols("SDB",from="2010-01-01",to="2010-02-01") sdb=as.data.frame(weeklyReturn(SDB)) sdb
I get:
weekly.returns 2010-01-08 -0.07830343 2010-01-15 -0.05176991 2010-01-22 0.07699487 2010-01-29 -0.05979203 2010-02-01 -0.02119816
I want to receive:
date weekly.returns 1 2010-01-08 -0.07830343 2 2010-01-15 -0.05176991 3 2010-01-22 0.07699487 4 2010-01-29 -0.05979203 5 2010-02-01 -0.02119816
How can i do this?
Note that this is an XTS object, not the underlying data.frame . After the conversion, I want the original data.frame names to appear in the new variable in the resulting data.frame .
source share