How do I get the percentile value for each row of a frame given a subset of the data?
I have a data calculation with 145 slots and over 1000 columns.
For each row, I would like to extract the 95th percentile value, but calculate only on data greater than or equal to 1.
I was able to calculate the value for each row, given all the data, as follows:
p95.obs <- apply(obs,1,quantile,probs=c(.95))
To include more than an option, I tried
p95.obs <- apply(obs>=1,1,quantile,probs=c(.95))
but this way I only got 1 for each line.
+3
source to share