[R] problem with apply(m, 1, min, na.rm=T)

Czerminski, Ryszard Ryszard.Czerminski at astrazeneca.com
Wed Jan 21 00:26:39 CET 2009


Passing extra arguments to FUN=mean or median in apply
seems fine, but when FUN=min warnings are generated?
See below.

Any ideas why?

Best regards,
Ryszard

Ryszard Czerminski
AstraZeneca Pharmaceuticals LP
 
> m
     [,1] [,2]
[1,]    1    2
[2,]    3   NA
[3,]   NA   NA
> apply(m, 1, median, na.rm=T)
[1] 1.5 3.0  NA
> apply(m, 1, mean, na.rm=T)
[1] 1.5 3.0 NaN
> apply(m, 1, min, na.rm=T)
[1]   1   3 Inf
Warning message:
In FUN(newX[, i], ...) : no non-missing arguments to min; returning Inf
>




More information about the R-help mailing list