Kirsten Miles
2009-May-20 18:23 UTC
[R] error message re: max(i), but code and output seen O.K.
I have a researcher who is consistently get the warning message: In max(i) : no non-missing arguments to max; returning -Inf 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@virginia.edu [[alternative HTML version deleted]]
Sundar Dorai-Raj
2009-May-20 20:52 UTC
[R] error message re: max(i), but code and output seen O.K.
This error is thrown if the argument to max is either NULL or length zero: [~] Rscript -e "max(NULL)" [1] -Inf Warning message: In max(NULL) : no non-missing arguments to max; returning -Inf [~] Rscript -e "max(numeric(0))" [1] -Inf Warning message: In max(numeric(0)) : no non-missing arguments to max; returning -Inf HTH, --sundar On Wed, May 20, 2009 at 11:23 AM, Kirsten Miles <sirole.uva at gmail.com> wrote:> I have a researcher who is consistently get the warning message: > > In max(i) : no non-missing arguments to max; returning -Inf > > 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. >
Rolf Turner
2009-May-20 21:03 UTC
[R] error message re: max(i), but code and output seen O.K.
On 21/05/2009, at 6:23 AM, 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 > > 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.(a) This is not an error message, it is a warning message. (b) The message says that, in a particular context, all of the arguments to max() are missing. Hence you are taking the maximum of the empty set. By definition this maximum is -infinity. (This makes good sense when you think about it carefully.) (c) What the implications are is hard to say without knowing what the code is actually doing. You say that the output is as expected; this *probably* means that the definition of the maximum of the empty set is meshing as it should with the remainder of the calculations. However if I were doing it, I'd track down the instance where all of the arguments to max are missing and make sure that the code really is doing the right thing. You have to decide what *is* the right thing. What *should* happen if all of the arguments are NA? One way to start tracking down the instance would be to set options(warn=2) to change the warning to a real error, and then use traceback() to see where the error occurred. cheers, Rolf Turner ###################################################################### Attention:\ This e-mail message is privileged and confid...{{dropped:9}}
David Scott
2009-May-20 22:32 UTC
[R] error message re: max(i), but code and output seen O.K.
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
Possibly Parallel Threads
- How to make a figure plotting p-values by range of different adjustment values?
- How to make a figure plotting p-values by range of different adjustment values?
- replace() error: new columns would leave holes after existing columns
- multiple secondary axes
- weight median by count for multiple records