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 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         6   smith         2
>
> I want know the number of unique authors per article.  I can get a table of
> article frequencies with table(articleID), but I can't figure out how to
> count frequencies in a different column.  I'm sure there's an easy way, but
> I guess I'm too new at this to find it.  Thanks for your help!
>
> Jason Priem
> PhD student, School of Information and Library Science, University of North
> Carolina-Chapel Hill
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to