lapply因异常值poisition
我正在使用此代码在数据框架中查找异常值。
out<-lapply(df[,-1], function(x) boxplot.stats(x)$out)
第一列只是名称(这就是为什么我要跳过它)。我找到了这种检测异常值的特定位置的方法。
out_ind <- which(df$col1 %in% c(out))
但是就我而言,对象“ out”不是一个 boxplot.stats(x)$ out ,所以我无法运行 ponter promula 。 如何编写它以在每个数据框架列中找到离群值的位置?
I'm using this code to find the outliers in the data frame.
out<-lapply(df[,-1], function(x) boxplot.stats(x)$out)
The first columns are just the names (that's why I'm skipping it). I've found this method to detect the specific position of the outliers.
out_ind <- which(df$col1 %in% c(out))
But in my case, the object "out" is not a single boxplot.stats(x)$out so I cannot run the which formula.
How can I write it to find the outliers' position in every single data frame column?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您现在有一个列表,因此您需要迭代它,例如使用
应用
函数:You now have a list, so you need to iterate over it, e.g. using the
apply
functions: