-1
我想子集数据框架只保留每个分类变量的第99.5百分位数。子集数据集为每个分类变量99.5th百分位数
我的数据已经用=分钟 和位置分钟=位置
我想拿出分钟数据的顶部.5成每个位置。
新的子集将有99.5个百分点的位置1. 99.5百分位置2,等等
谢谢!
我想子集数据框架只保留每个分类变量的第99.5百分位数。子集数据集为每个分类变量99.5th百分位数
我的数据已经用=分钟 和位置分钟=位置
我想拿出分钟数据的顶部.5成每个位置。
新的子集将有99.5个百分点的位置1. 99.5百分位置2,等等
谢谢!
这可能会解决您的问题,尽管如果您可以发布您的数据会非常有帮助。
library(plyr)
#add a column with information on where the 99.5% cutoff is
new.dataset1 <- ddply(your.dataset, "location", mutate, minutes.99.5.cutoff =
quantile(minutes.used, 0.95))
#subset the data to only include the bottom 99.5% of the data, then only
#select the first two columns
trimmed.dataset <- new.dataset1[which(new.dataset1$minutes.used <=
new.dataset1$minutes.99.5.cutoff),1:2]
欢迎来到Stack Overflow!你似乎在要求某人为你写一些代码。堆栈溢出是一个问答网站,而不是代码写入服务。请[see here](http://stackoverflow.com/help/how-to-ask)学习如何编写有效的问题。 – Junaid