[R] generic handling of NA and NaN and NULL

Robin Hankin r.hankin at auckland.ac.nz
Fri Feb 14 00:30:04 CET 2003


Hi Spencer


thanks for this


> How about:
> 
>  > f3 <- function(n){
> +   n.pi <- (abs(n)<pi)
> +   n.pi[is.na(n.pi)] <- F
> +   n.pi
> + }
>  >


nope!

Sometimes I need things like

R> x <- 1:10
R> if(f3(x[x>11])==TRUE){print("asfd")}
Error in if (f3(x[x > 11]) == TRUE) { : missing value where logical needed



best


rksh





-- 

Robin Hankin, Lecturer,
School of Geography and Environmental Science
Tamaki Campus
Private Bag 92019 Auckland
New Zealand

r.hankin at auckland.ac.nz
tel 0064-9-373-7599 x6820; FAX 0064-9-373-7042




More information about the R-help mailing list