Dear all,

I have a data frame of 6 columns and ~60000 rows which I hope to perform the 
following calculation on.

For each row, I wish to determine whether there are a greater number of 
positive or negative numbers. Then, if there are more positive numbers in the 
row, count how many occur - but if there are more negative numbers in the row, 
count them instead and insert a minus symbol before (e..g -4, to denote that 
this was determined on negative numbers).

If the number of positive and negative numbers in a given row are equal, then 
return a zero for that row.

Finally, if all values in a row are zero (i.e. neither positve or negative) 
then return -99999.


I've had a go at this myself for some considerable time, trying the use of an 
'apply' (by rows) function, but seem unable to successfully achieve the above.

Any help would be very gratefully received.

Many thanks,

Steve

                                          
_________________________________________________________________
Do you have a story that started on Hotmail? Tell us now

______________________________________________
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.

Reply via email to