[R] do not perform function if the outcome is NA

iza.ch1 iza.ch1 at op.pl
Tue Jul 23 23:58:27 CEST 2013

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

More information about the R-help mailing list