Wacek Kusnierczyk wrote: > Pascal A. Niklaus wrote: > >> Hi all, >> >> I ran into a problem in some of my code that could be traced back to 'mean' >> sometimes returning NA and sometimes NaN, depending on the value of na.rm: >> >> >> >>> mean(c()) >>> >>> >> [1] NA >> >> >> >>> mean(c(NA),na.rm=T) >>> >>> >> [1] NaN >> >> However, I don't understand the reasoning behind this and would appreciate >> and >> explanation. >> >> > > note the types: > > typeof(c()) > typeof(c(NA)) > typeof(c(NA)[-na.omit(c(NA))]) > >
wrong, an artifact of some experimenting; should have been: typeof(na.omit(c(NA))) vQ ______________________________________________ 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.