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

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -