Domanda

I've figured out how to load historical financial data from Google using the following code:

slb <- read.table( "slb.csv", header=TRUE, sep=",", col.names=c("date","open","high","low","close","volume") )
slb$date <- as.Date( slb$date, "%d-%b-%y" )
slb <- zoo( slb )

This works fine, but I'd like to accomplish this using the read.zoo() function, but I keep getting errors about "bad rows". Here is what I had tried using read.zoo().

slb <- read.zoo( "slb.csv", header=TRUE, sep=",", format="%d-%b-%y" )

Do you guys have any ideas for a one-liner? Thanks!

È stato utile?

Soluzione

The following seems to do it: read.zoo("http://www.google.com/finance/historical?q=NYSE%3ASLB&ei=SjFRU6jLKKGkwAPs2AE&output=csv", format="%d-%B-%y", header=TRUE, sep=",") Note the capital %B...

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top