Re: [R] missing TRUE/FALSE error in conditional construct

2008-08-13 Thread Moshe Olshansky
The problem is that if x is either NA or NaN then x != 0 is NA (and not FALSE or TRUE) and the function is.nan tests for a NaN but not for NA, i.e. is.nan(NA) returns FALSE. You can do something like: mat_zeroless[!is.na(mat) & mat != 0] <- mat[!is.na(mat) & mat != 0] --- On Thu, 14/8/08, rco

Re: [R] missing TRUE/FALSE error in conditional construct

2008-08-13 Thread Steven McKinney
> -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > On Behalf Of rcoder > Sent: Wednesday, August 13, 2008 3:17 PM > To: r-help@r-project.org > Subject: [R] missing TRUE/FALSE error in conditional construct > > > Hi everyone, > > I posted something similar to thi