Geo-sp
Geo-sp

Reputation: 1704

Creating subset based on threshold in R

I need to subset values in a data frame based on their upper 85-95% bin. Does any one know how I can do that?

Upvotes: 0

Views: 1611

Answers (1)

Paul Hiemstra
Paul Hiemstra

Reputation: 60924

You can use quantile to determine which value is the 85 or 95% bin. Next you can use normal R subset syntax to get only the data above that threshold.

df[df$value > quantile_thold,]

Upvotes: 3

Related Questions