Re: [R] Error Missing values where true/false needed

2014-11-26 Thread Michael Dewey
Comments in-line below On 26/11/2014 06:27, Frederic Ntirenganya wrote: Hi PIKAL, Actually I am Michael, Petr is one of the other respondents. The error seems to be starnge to me because i access the indices of NAs. Indices can't be non-applicable. But you are not testing the indexes, see

[R] Error Missing values where true/false needed

2014-11-25 Thread Frederic Ntirenganya
Dear All, I am getting this error and don't know why it comes. can you please help ? Error in if (data$Rain[i_NA] == 60) { : missing value where TRUE/FALSE needed The loop is : indicNAs - which(data$Rain %in% NA) ind_nonleap = c() # NAs due to non leap years ind_nonrecord = c() # NAs due

Re: [R] Error Missing values where true/false needed

2014-11-25 Thread PIKAL Petr
(1+1) else print(Errrorrr) [1] Errrorrr Cheers Petr -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Frederic Ntirenganya Sent: Tuesday, November 25, 2014 1:20 PM To: r-help@r-project.org Subject: [R] Error Missing values where

Re: [R] Error Missing values where true/false needed

2014-11-25 Thread Michael Dewey
You do not tell us what you are trying to do but I think there is something wrong in the logic of your thinking as on the one hand you are selecting just precisely those elements of data$Rain which are NA and then testing whether any of them equals 60. On 25/11/2014 12:19, Frederic

Re: [R] Error Missing values where true/false needed

2014-11-25 Thread Frederic Ntirenganya
Hi PIKAL, The error seems to be starnge to me because i access the indices of NAs. Indices can't be non-applicable. This is the output of indecs having the NA in my dataset. my dataset is very big that's why I did not provide it. indicNAs - which(data$Rain %in% NA) indicNAs [1] 426 792

Re: [R] Error Missing values where true/false needed

2014-11-25 Thread Boris Steipe
On Nov 26, 2014, at 1:27 AM, Frederic Ntirenganya ntfr...@gmail.com wrote: The error seems to be starnge to me because i access the indices of NAs. No you don't. You access the contents of the cell via an index for which you have previously determined that the contents is NA. Then you compare

Re: [R] Error Missing values where true/false needed

2014-11-25 Thread PIKAL Petr
-Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Frederic Ntirenganya Sent: Wednesday, November 26, 2014 7:27 AM To: Michael Dewey Cc: r-help@r-project.org Subject: Re: [R] Error Missing values where true/false needed Hi PIKAL, The error seems

[R] Error: missing values where TRUE/FALSE needed

2011-06-08 Thread Abraham Mathew
I'm writing a function and keep getting the following error message. myfunc - function(lst) { lst - list(roots = c(car insurance, auto insurance), roots2 = c(insurance), prefix = c(cheap, budget), prefix2 = c(low cost), suffix = c(quote, quotes), suffix2 = c(rate, rates), suffix3 = c(comparison))

Re: [R] Error: missing values where TRUE/FALSE needed

2011-06-08 Thread Joshua Wiley
Hi Abraham, mylist - list(roots = car, prefix = cheap) myfoo - function(x) { print(mylist$x) } myfoo(roots) ## fails, but in a sneaky way ## you actually extract variable x from mylist ## but there is no variable x (it is just NULL) ## so while no error is thrown, you get nothing myfoo -