Compute mean from the object returned by "getSymbols()" in R package "quantmod" -


i compute moments object returned "getsymbols()" in r package "quantmod". object isn't vector or matrix, there error. how can that? following code:

> library(quantmod) > getsymbols("axp", = "2007-01-01", = "2013-12-31") > returns = diff(axp[,6]) / lag(axp[,6]) * 100 # calculate simple return adjusted prices > mean(returns) [1] na > var(returns)                 axp.adjusted   axp.adjusted           na 

how can calculate sample mean , variance? thanks!


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -