[R] counting frequencies across two columns

2009-11-01 Thread Jason Priem
I've got a data frame describing comments on an electronic journal, wherein each row is a unique comment, like so: commentID author articleID 1 1 smith 2 2 2 jones 3 3 3 andrews 2 4 4 jones 1 5 5 johnson 3 6

Re: [R] counting frequencies across two columns

2009-11-01 Thread milton ruser
Hi Jason, As your example is not reproducible, may be something like: myFreq-data.frame(table(articleID, author)) if you want to know only those articles with 1 author, you can try subset(myFreq, Freq==1) or something like. bests milton On Sun, Nov 1, 2009 at 2:20 AM, Jason Priem

Re: [R] counting frequencies across two columns

2009-11-01 Thread Patrick Connolly
On Sun, 01-Nov-2009 at 01:20AM -0500, Jason Priem wrote: I've got a data frame describing comments on an electronic journal, wherein each row is a unique comment, like so: commentID author articleID 1 1 smith 2 2 2 jones 3 3 3 andrews

Re: [R] counting frequencies across two columns

2009-11-01 Thread David Winsemius
On Nov 1, 2009, at 1:59 AM, Patrick Connolly wrote: On Sun, 01-Nov-2009 at 01:20AM -0500, Jason Priem wrote: I've got a data frame describing comments on an electronic journal, wherein each row is a unique comment, like so: commentID author articleID 1 1 smith 2 2

Re: [R] counting frequencies across two columns

2009-11-01 Thread Jorge Ivan Velez
Hi Jason, If I understand correctly, you are looking for something along the lines of with(X, tapply(author, articleID, function(x) length(unique(x # 1 2 3 # 1 2 2 with X your data frame. HTH, Jorge On Sun, Nov 1, 2009 at 1:20 AM, Jason Priem wrote: I've got a data frame describing