> > 3. temp <- as.Date('1990/1/1') - as.date('1953/2/5') > > sqrt(temp) > > Error in Math.difftime(temp3) : sqrtnot defined for "difftime" objects > > > > Minor bug: no space before the word 'not' > > Major: this shouldn't fail. > > > > > Arguably, it should (Is this a difftime object? Which units?). > I'd advise against numeric operation on difftime objects in general, > because of the unspecified units. These are always "days" when working > with Date objects, but with general time objects it is not predictable. > So I'd recommend sqrt(as.numeric(temp, units="days")).
Why not just always use seconds for difftime objects? An attribute could control how it was formatted, but would be independent of the underlying representation. Hadley ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel