Hi,
I have a dataframe in which I need to create a new column by counting all values equal to or greater than 1 occurring row-wise. I tried to use the following command:
length(which(birds[2, 3:29] > 0))
This command only returns a value for ONE row (in this case, the 2nd row).
However, I want a column that lists such values for ALL rows.
Please help me through this.
I have a dataframe in which I need to create a new column by counting all values equal to or greater than 1 occurring row-wise. I tried to use the following command:
length(which(birds[2, 3:29] > 0))
This command only returns a value for ONE row (in this case, the 2nd row).
However, I want a column that lists such values for ALL rows.
Please help me through this.