[R] ifelse on a series of rows for multiple criteria

Thomas Liebig thomas.liebig at iais.fraunhofer.de
Fri Feb 5 17:43:19 CET 2010


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.liebig at iais.fraunhofer.de
Phone:  +49 2241 142050
Fax:    +49 2241 142072



More information about the R-help mailing list