Is there any way to get a numerical summary of the values of a difftime object? E.g. TimeToWean <- difftime(WeanDate, BirthDate, units = "days") I can repeat sum(TimeToWean == 20) with as many other values are needed to build up a frequency table, but is there a simpler way in R version 1.8.1? =====================================I.White ICAPB, University of Edinburgh Ashworth Laboratories, West Mains Road Edinburgh EH9 3JT Fax: 0131 650 6564 Tel: 0131 650 5490 E-mail: iwhite at staffmail.ed.ac.uk
I M S White wrote:> Is there any way to get a numerical summary of the values of a difftime > object? E.g. > > TimeToWean <- difftime(WeanDate, BirthDate, units = "days") > > I can repeat > > sum(TimeToWean == 20) > > with as many other values are needed to build up a frequency table, > but is there a simpler way in R version 1.8.1?Are you looking for table() ? Uwe Ligges
I M S White wrote:> Is there any way to get a numerical summary of the values of a difftime > object? E.g. > > TimeToWean <- difftime(WeanDate, BirthDate, units = "days") > > I can repeat > > sum(TimeToWean == 20) > > with as many other values are needed to build up a frequency table, > but is there a simpler way in R version 1.8.1? >perhaps tabulate() will do what you want. For a somewhat more expansive output, you might look at the freq() function in "Kickstarting R" which can be browsed online at: http://cran.r-project/doc/contrib/Lemon-kickstart/index.html see the section "Frequencies". Jim