[R] my own function given to lapply

Christoph Lehmann christoph.lehmann at gmx.ch
Thu Feb 26 18:39:13 CET 2004


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




-- 
Christoph Lehmann <christoph.lehmann at gmx.ch>




More information about the R-help mailing list