On Feb 5, 2010, at 10:48 AM, Steve Murray wrote:
Dear all,
I am attempting to perform a calculation which counts the number of
positive (or negative) values based on the sample mean (on a per-row
basis). If the mean is>0 then only positive values should be
counted, and if the mean is <0
Hi Steve,
as far as i understood, you're trying to do this:
direction_func <- function(combdframe) {
ifelse(mean(combdframe==0), -9,
sum((sign(mean(combdframe))*combdframe)>0))
}
direction<-apply(combdframe, 1, direction_func)
direction
cheers,
thomas
--
Thomas Liebig
Fraunhofe
Dear all,
I am attempting to perform a calculation which counts the number of positive
(or negative) values based on the sample mean (on a per-row basis). If the mean
is>0 then only positive values should be counted, and if the mean is <0 then
only negative values should be counted. In cases w
3 matches
Mail list logo