Skip to content
Prev 28113 / 398500 Next

generic handling of NA and NaN and NULL

How about the following modification:

 > f3 <- function(n){
+   if(length(n)<1)return(FALSE)
+   n.pi <- (abs(n)<pi)
+   n.pi[is.na(n.pi)] <- FALSE
+   n.pi
+ }
 >
 >  x <- 1:10
 > f3(x[x>11])
[1] FALSE

Spencer
Liaw, Andy wrote: