Hi Steve, as far as i understood, you're trying to do this:
direction_func <- function(combdframe) { ifelse(mean(combdframe==0), -99999, sum((sign(mean(combdframe))*combdframe)>0)) } direction<-apply(combdframe, 1, direction_func) direction cheers, thomas -- Thomas Liebig Fraunhofer-Institut für Intelligente Analyse- und Informationssysteme (IAIS) Schloss Birlinghoven, D-53754 Sankt Augustin, Germany Email: thomas.lie...@iais.fraunhofer.de Phone: +49 2241 142050 Fax: +49 2241 142072 ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.