In this data set, two Taxa (in Rows) contribute little to the overall data and i would like to gather all these rows, whose rowsums are less than n% of the entire dataset. n could be 1, 2, 3...
df <- data.frame(A=c(1000,100,1,0), B=c(100,1000,1,1), C=c(10,900,0,1))
row.names(df) <- c("Tax1", "Tax2", "Tax3", "Tax4")
> df
A B C
Tax1 1000 100 10
Tax2 100 1000 900
Tax3 1 1 0
Tax4 0 1 1
After identifying these low sum rows, i would like to bin them to e.g. "Other":
> df
A B C
Tax1 1000 100 10
Tax2 100 1000 900
Other 1 2 1
Thank you!