[R] mean for vector with NA

2008-08-21 Thread bad2101
I am trying to find the mean for the elements in the vector Incubation=as.POSIXlt(OnsetTime)-as.POSIXlt(MealTime) where OnsetTime=c(NA,"1940-04-19 00:30","1940-04-19 00:30","1940-04-19 00:30",NA,"1940-04-18 22:30","1940-04-18 22:30","1940-04-19 02:00","1940-04-19 01:00","1940-04-18 23:00",N

[R] mean for vector with NA

2008-08-21 Thread bad2101
Thanks for all the help. I'll do some more reading. Brian __ 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, se

Re: [R] mean for vector with NA

2008-08-21 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > [EMAIL PROTECTED] > Sent: Thursday, August 21, 2008 12:15 PM > To: r-help@r-project.org > Subject: [R] mean for vector with NA > > I am trying to find the mean for

Re: [R] mean for vector with NA

2008-08-21 Thread Roland Rau
Hi, [EMAIL PROTECTED] wrote: I have tried mean(Incubation) and mean(as.numeric(Incubation)) what about mean(Incubation, na.rm=TRUE) ? I get the following result: > mean(Incubation, na.rm=TRUE) Time difference of 4.295455 hours > but I think that, since there are so many NA values in Incu