Dear R-list,
I have data in the following format: Country 1 Country 2 Country 3 ... 1 0 1 0 2 1 0 2 3 0 1 0 Now I would like to create a variable that counts every non-zero element of the rows, so for the above example it would be: Count 1 1 2 2 3 1 Any help from is greatly appreciated! With kind regards Thomas ______________________________________________ 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.