find the ten lowest total cash flows. Add up the columns:
total.cashflow <- drop(colSums(TOTKS, na.rm=TRUE))
Then find which are the 10% lowest:
rank.cashflow.le10 <- which(
total.cashflow <= qualtile(total.cashflow, 0.1)
)
Add them to the plot:
matlines(timeline, TOTKS[,rank.cashflow.le10], col="red")
To examine those as a separate matrix (but you might not need to, with a vector of indicies)
low10TOTKS <- TOTKS[,rank.cashflow.le10]