Re: [R] grouping and counting in dataframe

2011-02-27 Thread jim holtman
Here is one solution; mine differs since there should be at least one item in the range which would be itself: tm gr 1 12345 1 2 42352 3 3 12435 1 4 67546 2 5 24234 2 6 76543 4 7 31243 2 8 13334 3 9 64562 3 10 64123 3 > d$ct <- ave(d$tm, d$gr, FUN = function(x){ + # de

Re: [R] grouping and counting in dataframe

2011-02-27 Thread zem
have nobody any idea? i have already try with tapply(d,gr, ... ) but i have problems with the choose of the function ... also i am not really sure if that is the right direction with tapply ... it'll be really great when somebody comes with new suggestion.. 10x -- View this message in context

Re: [R] grouping and counting in dataframe

2011-02-26 Thread zem
sry, new try: tm<-c(12345,42352,12435,67546,24234,76543,31243,13334,64562,64123) gr<-c(1,3,1,2,2,4,2,3,3,3) d<-data.frame(cbind(time,gr)) where tm are unix times and gr the factor grouping by i have a skalar for example k=500 now i need to calculate in for every row how much examples in the g

Re: [R] grouping and counting in dataframe

2011-02-25 Thread David Winsemius
On Feb 25, 2011, at 8:28 PM, zem wrote: hi all, i have a little problem, i have some code writen, but it is to slow... i have a dataframe with a column of time series and a grouping column, really there is no metter if in the first col what kind of data is, it can be a random number like