在传递带有向量“ Attr1”,“ Attr2”的数据列时,即时通讯出现错误
火车是数据名称 Attr1,Attr2是列名 我需要将所有异常值替换为NA
outlierKD <- function(dt, var) {
print(var)
for (i in var) {
print(i)
var_name <- eval(as.character(substitute(i)),eval(dt))
outlier<-boxplot.stats(var_name)$out
var_name<-ifelse(var_name %in% outlier,NA,var_name)
dt[as.character(substitute(i))] <- invisible(var_name)
assign(as.character(as.list(match.call())$dt), dt, envir = .GlobalEnv)
message("Outliers successfully removed", "\n")
}
return(invisible(dt))
}
#################### Errorpart ############################# ################# outlierKD(train,c(“ Attr2”,“ Attr3”))[1]“ Attr2”“ Attr3” [1]“ Attr2”在x [floor(d)]中显示带有调试错误的回溯重新运行+ x [ceiling(d)]:二进制运算符的非数字参数