Re: [R] Error: missing value where TRUE/FALSE needed
Dear Shashi Seth, The principal problem here is that the "argument" to if() must be logical, while comparing anything to NA always produces NA. The proper way to test for NA is with is.na(). There's potentially something more subtle going on here, however, which is that even if some of the elements of the logical expression in the "call" to if() are NA, the expression may evaluate to FALSE (but never to TRUE) if the non-NA elements imply that it is FALSE. Consider the following examples: > TRUE && FALSE && NA # FALSE regardless of the value of the last element [1] FALSE > TRUE && TRUE && NA # truth depends on the value of the last element [1] NA > (TRUE && FALSE && NA) != NA [1] NA > (TRUE && TRUE && NA) != NA [1] NA > is.na(TRUE && FALSE && NA) [1] FALSE > is.na(TRUE && TRUE && NA) [1] TRUE I hope that this helps, John - John Fox, Professor McMaster University Hamilton, Ontario Canada L8S 4M4 Web: socserv.mcmaster.ca/jfox > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of SHASHI SETH > Sent: June 9, 2016 2:53 AM > To: R-help@r-project.org > Subject: [R] Error: missing value where TRUE/FALSE needed > > Hi, > > > > I am getting the following error: > > Error in if ((sum > 0 && sums1 > 0 && sums2 > 0) != NA) { : > > missing value where TRUE/FALSE needed > > > > > > I have including my code below for your review: > > > > fitness_1_data > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
Re: [R] Error: missing value where TRUE/FALSE needed
Dear Shashi, I don't see any code, but I will take a guess anyway: The error tells you that you try to compare a boolean with something that is not (TRUE or FALSE cannot be compared to NA). HTH Ulrik On Thu, 9 Jun 2016 at 08:55 SHASHI SETHwrote: > Hi, > > > > I am getting the following error: > > Error in if ((sum > 0 && sums1 > 0 && sums2 > 0) != NA) { : > > missing value where TRUE/FALSE needed > > > > > > I have including my code below for your review: > > > > fitness_1_data > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. > [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
[R] Error: missing value where TRUE/FALSE needed
Hi, I am getting the following error: Error in if ((sum > 0 && sums1 > 0 && sums2 > 0) != NA) { : missing value where TRUE/FALSE needed I have including my code below for your review: fitness_1_data [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.
Re: [R] ERROR: missing value where TRUE/FALSE needed
Hi What is mctp? Why do you think your data are well defined? Did you try str(Datos)? Where you get this error? When you do call mctp or summary? The main problem is that you do not follow posting guide, do not provide reproducible code and/or at least some info about your data. Without that I wonder if anybody can resolve your problem. Regards Petr -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Lee Jejen Sent: Tuesday, July 16, 2013 11:29 PM To: r-help@r-project.org Subject: [R] ERROR: missing value where TRUE/FALSE needed Hello, I have a problem... I tried using a function and I get the error: ERROR: missing value where TRUE/FALSE needed Here is my code: a-mctp(Ecoli~Fecha, data=Datos, type = Tukey, alternative = two.sided, asy.method = mult.t, plot.simci = TRUE)summary(a) Ecoli, Fecha and Datos are well defined. I don't know what is the problem... THANKS [[alternative HTML version deleted]] __ R-help@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. __ R-help@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.
Re: [R] ERROR: missing value where TRUE/FALSE needed
In addition to what Petr said, That message most likely means that you have some missing data where you're not allowed to have missing data in your Datos. Look and see if the mctp() function has an argument that controls what it does with missing data. -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 7/16/13 2:29 PM, Lee Jejen yitus...@hotmail.com wrote: Hello, I have a problem... I tried using a function and I get the error: ERROR: missing value where TRUE/FALSE needed Here is my code: a-mctp(Ecoli~Fecha, data=Datos, type = Tukey, alternative = two.sided, asy.method = mult.t, plot.simci = TRUE)summary(a) Ecoli, Fecha and Datos are well defined. I don't know what is the problem... THANKS [[alternative HTML version deleted]] __ R-help@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. __ R-help@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.
[R] ERROR: missing value where TRUE/FALSE needed
Hello, I have a problem... I tried using a function and I get the error: ERROR: missing value where TRUE/FALSE needed Here is my code: a-mctp(Ecoli~Fecha, data=Datos, type = Tukey, alternative = two.sided, asy.method = mult.t, plot.simci = TRUE)summary(a) Ecoli, Fecha and Datos are well defined. I don't know what is the problem... THANKS [[alternative HTML version deleted]] __ R-help@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.
Re: [R] Error .. missing value where TRUE/FALSE needed
When the error occurs, valueDiff is NA: Error in if ((seedCount = seedNumber) (valueDiff sup)) { : missing value where TRUE/FALSE needed valueDiff [1] NA Look at your loop; you are going through 100 times so on the last time you are trying to access: fcsPar[k+1] which is the 101th entry which is NA. Your program has a bug in it. On Jan 6, 2008 1:22 AM, Nicholas Crosbie [EMAIL PROTECTED] wrote: Can any explain the following error: Error in if ((seedCount = seedNumber) (valueDiff sup)) { : missing value where TRUE/FALSE needed which I get upon running this script: seedNumber - 10 seeds - array(dim = seedNumber) seedCount - 1 maxValue - 100 sup - maxValue / 2 fcsPar - array(as.integer(rnorm(100, 50, 10))) while (seedCount = seedNumber) { for(k in 1:100) { valueDiff - abs(fcsPar[k] - fcsPar[k+1]) if((seedCount = seedNumber) (valueDiff sup)) {#error seeds[seedCount] - fcsPar[k] seedCount - seedCount + 1 } } sup - sup / 2 } many thanks. Make the switch to the world's best email. Get the new Yahoo!7 Mail now. www.yahoo7.com.au/worldsbestemail __ R-help@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. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? __ R-help@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.
[R] Error: missing value where TRUE/FALSE needed
Can any explain the following error: Error in if ((seedCount = seedNumber) (valueDiff sup)) { : missing value where TRUE/FALSE needed which I get upon running this script: seedNumber - 10 seeds - array(dim = seedNumber) seedCount - 1 maxValue - 100 sup - maxValue / 2 fcsPar - array(as.integer(rnorm(100, 50, 10))) while (seedCount = seedNumber) { for(k in 1:100) { valueDiff - abs(fcsPar[k] - fcsPar[k+1]) if((seedCount = seedNumber) (valueDiff sup)) {#error seeds[seedCount] - fcsPar[k] seedCount - seedCount + 1 } } sup - sup / 2 } many thanks. Make the switch to the world's best email. Get the new Yahoo!7 Mail now. www.yahoo7.com.au/worldsbestemail __ R-help@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.
Re: [R] Error: missing value where TRUE/FALSE needed
make k = 100, note that you're doing fcsPar[k]-fcsPar[k+10] note fcsPar has length 100... therefore valueDiff becomes NA.. and the if() statement fails. b On Jan 6, 2008, at 1:16 AM, Nicholas Crosbie wrote: Can any explain the following error: Error in if ((seedCount = seedNumber) (valueDiff sup)) { : missing value where TRUE/FALSE needed which I get upon running this script: seedNumber - 10 seeds - array(dim = seedNumber) seedCount - 1 maxValue - 100 sup - maxValue / 2 fcsPar - array(as.integer(rnorm(100, 50, 10))) while (seedCount = seedNumber) { for(k in 1:100) { valueDiff - abs(fcsPar[k] - fcsPar[k+1]) if((seedCount = seedNumber) (valueDiff sup)) {#error seeds[seedCount] - fcsPar[k] seedCount - seedCount + 1 } } sup - sup / 2 } many thanks. Make the switch to the world's best email. Get the new Yahoo!7 Mail now. www.yahoo7.com.au/worldsbestemail __ R-help@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. __ R-help@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.
Re: [R] Error: missing value where TRUE/FALSE needed
errata: fcsPar[k+1] On Jan 6, 2008, at 1:50 AM, Benilton Carvalho wrote: make k = 100, note that you're doing fcsPar[k]-fcsPar[k+10] note fcsPar has length 100... therefore valueDiff becomes NA.. and the if() statement fails. b On Jan 6, 2008, at 1:16 AM, Nicholas Crosbie wrote: Can any explain the following error: Error in if ((seedCount = seedNumber) (valueDiff sup)) { : missing value where TRUE/FALSE needed which I get upon running this script: seedNumber - 10 seeds - array(dim = seedNumber) seedCount - 1 maxValue - 100 sup - maxValue / 2 fcsPar - array(as.integer(rnorm(100, 50, 10))) while (seedCount = seedNumber) { for(k in 1:100) { valueDiff - abs(fcsPar[k] - fcsPar[k+1]) if((seedCount = seedNumber) (valueDiff sup)) {#error seeds[seedCount] - fcsPar[k] seedCount - seedCount + 1 } } sup - sup / 2 } many thanks. Make the switch to the world's best email. Get the new Yahoo!7 Mail now. www.yahoo7.com.au/worldsbestemail __ R-help@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. __ R-help@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. __ R-help@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.