Now one more error to sort .... 
 
Enclosed is the code as well as the error
 
library(quantmod)
getSymbols("INFY.BO", from="2008-01-01")
data<-INFY.BO
#check data
head(data)
#Add the SMA/LMA
h=data[,4]
c=data[,5]
hcdif=h-c
data$smv=filter(data[,5],rep(1/7,7), sides=1)  
data$lmv=filter(data[,5],rep(1/21,21), sides=1)

The data$smv has not error
 
However, for data$lmv has the following error
 
Warning message:
In data$lmv = filter(data[, 5], rep(1/21, 21), sides = 1) :
  Coercing LHS to a list

Any ideas how to go about this???
 
Sean
	[[alternative HTML version deleted]]

