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 Incubation, R
gives a mean value of NA.
R returns (correctly) NA for such operations when NAs occur in the
dataset. Sorry, but I don't know where to find it at the moment but
there is standard for this.
It has nothing to do with the proportion of NAs in the dataset
("...since there are so many NA values...")
Is there any way of either extracting all
numeric values (i.e. all non-NA values) from the Incubation vector,
Incubation[is.numeric(Incubation)]
but this is probably not what you want, since the NAs are also
considered numeric:
> is.numeric(Incubation)
[1] TRUE
or
finding the mean value of only the numeric values in the Incubation vector?
see above:
NAs are also numeric in this case
mean(Incubation[is.numeric(Incubation)])
> mean(Incubation[is.numeric(Incubation)])
Time difference of NA hours
>
Hope this helps,
Roland
______________________________________________
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.