R:获取离群值的索引值的数据帧

发布于 2025-01-13 01:17:41 字数 388 浏览 0 评论 0原文

我有一个包含 170 个变量的数据集,第一个是客户 ID,我将其转换为数据框的索引:

input2 <- data.frame(input2[,-1], row.names = input2[,1])

我已经找到了异常值:

   outliers <- boxplot(input2)$out

但现在我想创建一个数据框,其中我有被视为异常值的客户 ID。由于“异常值”的输出是一个列表,我怎样才能得到这个?

编辑:我尝试过

which(input2 %in% outliers)

,但它给出了“integer(0)”作为输出

谢谢

I have a dataset with 170 variables and the first one is Customer ID which I converted as index of the data frame:

input2 <- data.frame(input2[,-1], row.names = input2[,1])

I already found the outliers:

   outliers <- boxplot(input2)$out

but now I want to create a data frame where I have the Customer ID that are considered outliers. How can I get this since the output of "outliers" is a list?

Edit: I tried

which(input2 %in% outliers)

but it gives "integer(0)" as output

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文