[R] error message re: max(i), but code and output seen O.K.

David Scott d.scott at auckland.ac.nz
Thu May 21 00:32:39 CEST 2009

On Wed, 20 May 2009, Kirsten Miles wrote:

> I have a researcher who is consistently get the warning message:
> In max(i) : no non-missing arguments to max; returning -Inf

You get this message when trying to take the maximum of a vector with no 
elements. I am guessing he is looping through and in some cases getting an 
empty vector.

> x <- numeric(0)
> max(x)
[1] -Inf
Warning message:
In max(x) : no non-missing arguments to max; returning -Inf

David Scott

> Best as I can tell the code is working properly and the output is as
> expected. I would like some help in understanding why he is getting this
> error message and what its implications are.  I have his code.
> Sincerely,
> Kirsten Miles
> Support Specialist
> Research Computing Lab
> Charles L. Brown Science and Engineering Library
> kdm3d at virginia.edu
> 	[[alternative HTML version deleted]]
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Scott	Department of Statistics
 		The University of Auckland, PB 92019
 		Auckland 1142,    NEW ZEALAND
Phone: +64 9 923 5055, or +64 9 373 7599 ext 85055
Email:	d.scott at auckland.ac.nz,  Fax: +64 9 373 7018

Graduate Officer, Department of Statistics
Director of Consulting, Department of Statistics

More information about the R-help mailing list