From therneau at mayo.edu  Wed Jun 14 15:02:52 2017
From: therneau at mayo.edu (Therneau, Terry M., Ph.D.)
Date: Wed, 14 Jun 2017 08:02:52 -0500
Subject: [Rd] spurious warning in ave()
Message-ID: <9153c6$71a8hp@ironport10.mayo.edu>

Consider the following simple data set and a call to ave:

 > tdata <- data.frame(f1=c(1,1,1,1,2,2,2,2), f2=c(1,2,1,2,1,1,1,1), y=1:8)
 > with(tdata, table(f1, f2))
    f2
f1  1 2
   1 2 2
   2 4 0

 > with(tdata, ave(y, f1, f2, FUN=max))

[1] 3 4 3 4 8 8 8 8
Warning message:
In FUN(X[[i]], ...) : no non-missing arguments to max; returning -Inf

There are no missing values in the result.  The fact that ave() apparently tried to find 
the max for a combination it did not need is irrelvant to the user, and the warning is 
counterproductive.

Terry T.



[Rd] spurious warning in ave()
Therneau, Terry M., Ph.D.