我正在尝试编写一个函数,该函数可以为img{
width: 128px;
/*height must be proportional to width otherwise image get stretch*/
}
对象中的data.frame
的每列提供异常值的位置。因此,我在这个post中调整了@timothyjgraham建议的功能。
list
当输入FindOutliers <- function(data) {
lowerq = apply(data, 2, quantile)[2,]
upperq = apply(data, 2, quantile)[4,]
iqr = upperq - lowerq
#identify extreme outliers
extreme.threshold.upper = (iqr * 3) + upperq
extreme.threshold.lower = lowerq - (iqr * 3)
result <- list()
for (i in 1:ncol(data)) {
result[[i]]<-which(data[,i] > extreme.threshold.upper[i] | data[,i] < extreme.threshold.lower[i])
}
}
只有一列时,此功能正常,但在使用&gt; 1列时出现以下错误:
data.frame
当我在函数外部运行具有相同数据集的代码时,一切正常。