Skip to content
Prev 325651 / 398503 Next

alternative to ifelse

On Jun 19, 2013, at 1:23 PM, Marc Schwartz <marc_schwartz at me.com> wrote:

            
Actually, correction. That works in the case where only one of the values in the row is a 1, which happened to fit the example data. If there is a chance that more than one value in a row may be a 1, it returns a value equal to the number of 1's found.

Thus, a more generic approach, I believe, would be:
[1] 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0


Regards,

Marc