I have prices for several securities in a data frame. I'm wondering how to
calculate returns for each of them in a vectorized fashion.

require(quantmod)
group <-c('FNMIX','DBLTX','AGG','^GSPC')
getSymbols(group, src="yahoo", from="2012-01-01", to=Sys.Date())
y <- merge(FNMIX[,4],DBLTX[,4],AGG[,4],GSPC[4])
x <-sapply(y[,1:4], dailyReturn)

When I execute the above code I get an "error in arrary" message that
indicates that the "length of dim names [1] not equal to array extent".

What am I doing wrong ?

	[[alternative HTML version deleted]]

