Re: [R] problem with NA and if

2008-07-04 Thread Keld J?rn Simonsen
On Fri, Jul 04, 2008 at 04:44:53PM +1000, Andrew Robinson wrote: > Hi Keld > > you should read ?sum. > > sum(c(1,2,NA), na.rm=TRUE) Thanks, that solved my problem. Best regars keld > Cheers > > Andrew > > On Fri, Jul 04, 2008 at 08:29:34AM +0200, Keld J?rn Simonsen wrote: > > Hi > > > > I

Re: [R] problem with NA and if

2008-07-04 Thread Albert Greinoecker
try is.na() regards, Albert Am Freitag, den 04.07.2008, 08:29 +0200 schrieb Keld Jørn Simonsen: > Hi > > I would like to sum a number of time series, some of them having NA's > > Standard action is here that if I sum a value with a NA, then the result > is NA. I would like it to just keep the

Re: [R] problem with NA and if

2008-07-04 Thread Bill.Venables
3286 7700 mailto:[EMAIL PROTECTED] http://www.cmis.csiro.au/bill.venables/ -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Keld Jørn Simonsen Sent: Friday, 4 July 2008 4:30 PM To: r-help@r-project.org Subject: [R] problem with NA and if Hi I would li

Re: [R] problem with NA and if

2008-07-03 Thread Andrew Robinson
Hi Keld you should read ?sum. sum(c(1,2,NA), na.rm=TRUE) Cheers Andrew On Fri, Jul 04, 2008 at 08:29:34AM +0200, Keld J?rn Simonsen wrote: > Hi > > I would like to sum a number of time series, some of them having NA's > > Standard action is here that if I sum a value with a NA, then the res

[R] problem with NA and if

2008-07-03 Thread Keld Jørn Simonsen
Hi I would like to sum a number of time series, some of them having NA's Standard action is here that if I sum a value with a NA, then the result is NA. I would like it to just keep the value. I then try to: a = NA; if (a == NA) { a = 0} just to try it out, but it says Error in if (a == NA)