Skip to content
Prev 44917 / 398528 Next

my own function given to lapply

Hi 

It seems, I just miss something. I defined 

treshold <- function(pred) {
if (pred < 0.5) pred <- 0 else pred <- 1
return(pred)
}

and want to use apply it on a vector

sapply(mylist[,,3],threshold)

but I get:

Error in match.fun(FUN) : Object "threshold" not found

thanks for help
cheers

chris