Hi Rui
Thanks a lot. It works perfect.
Izzie
Hello,
Try the following.
standardised.abnormal.returns <-
lapply(seq_len(ncol(abnormal.returns)),function(i) {
if(standard.deviation[i,1] == 0)
abnormal.returns[,i]
else
abnormal.returns[,i]/standard.deviation[i,1]
})
Hope this helps,
Rui Barradas
Em 23-07-2013 22:58, iza.ch1 escreveu:
Hi you all
I have a question regarding the function. In my function I divide
the values by the standard errors and sometimes the standard error is
equal to zero and I get the result NA. Can I write the function in the
way that if the outcome of the function is zero then the function is
not conducted and it stays the value (not divided by standard errors)?
the code for my function is the following:
standardised.abnormal.returns<-lapply(seq_len(ncol(abnormal.returns)),function(i)
{abnormal.returns[,i]/standard.deviation[i,1]})
Thank you all for the help