如何使用R中的循环打印离群值?
我想使用for-loop
创建算法,该算法,返回每个数字(或整数)变量的最低离群值。最低离群值由BoxPlot IE定义:boxplot.stats(dataframe [[n]])$ out
。 如果在该数字/整数列中不存在异常值,则打印第二个字符串。
for(i in df){
lowest <- ifelse(is.numeric(i), min(boxplot.stats(i)$out), "not numeric/integer")
print(ifelse(lowest != "Inf", lowest, "No outliers"))
}
我已经对此进行了管理,但我得到了以下警告:
Warning message:
In min(boxplot.stats(i)$out) :
no non-missing arguments to min; returning Inf
I want to create an algorithm using a for-loop
that returns the lowest outlier for each numeric (or integer) variable. Where the lowest outlier is defined by a boxplot i.e. : boxplot.stats(dataframe[[n]])$out
.
And print a second string if no outliers exist within that numeric/integer column.
for(i in df){
lowest <- ifelse(is.numeric(i), min(boxplot.stats(i)$out), "not numeric/integer")
print(ifelse(lowest != "Inf", lowest, "No outliers"))
}
I have managed with this but I get the following warning:
Warning message:
In min(boxplot.stats(i)$out) :
no non-missing arguments to min; returning Inf
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论