我有一个分类的概率数组
post <- c(0.73,0.69,0.44,0.55,0.67,0.47,0.08,0.15,0.45,0.35)
我想检索预测的类。现在我用
predicted <- function(post) {
function(threshold) {plyr::aaply(post, 1,
function(x) {if(x >= threshold) '+' else '-'})}}
但这似乎是 R 有语法的东西。
是否有一些更直接的索引表达式?