Re: [R] calculating the occurrences of distinct observations in the subsets of a dataframe

2011-03-17 Thread Tóth Dénes
Hi! Sorry, I made an error in the previous e-mail. So try this: by(df[,-1],df$id,function(x) apply(x,2,tabulate)) This gives you a list. You can rearrange it into a data frame or a 3d array if you wish. Regards, Denes > Hello everybody, > > I have a data frame in R which is similar to the

[R] calculating the occurrences of distinct observations in the subsets of a dataframe

2011-03-17 Thread Bodnar Laszlo EB_HU
Hello everybody, I have a data frame in R which is similar to the follows. Actually my real 'df' dataframe is much bigger than this one here but I really do not want to confuse anybody so that is why I try to simplify things as much as possible. So here's the data frame. id <-c(1,1,1,1,1,1,1,1