Dear Cameron,

This is not with unique, but it gets the job done.  Just create a new
variable that is the three variables concatenated together.  Then, you can
just sum by this variable, like the following:

mymat <- matrix(letters, ncol=3, nrow=260)
mymat <- as.data.frame(mymat)
mymat$dat <- rnorm(260)
mymat$id <- paste(mymat[,1], mymat[,2], mymat[,3])
aggregate(mymat$dat, list(mymat$id), sum)

HTH,
Dave.

On 5/10/06, Robert Citek <[EMAIL PROTECTED]> wrote:

>
> On May 10, 2006, at 4:02 PM, Guenther, Cameron wrote:
> > How can I use unique to extract the rows that have repeated tripid's
> > only, not a unique value for each variable but only for TRIPID.  I
> > then
> > want to condense the unique values by summing the CONVUNIT for each
> > unique value of TRIPID.
>
> Thanks, Cameron, for this question.  This type of manipulation would
> be relatively simple to do in a RDBMS (e.g. MySQL, PostgreSQL,
> Oracle, etc.)  But I'm curious to see how one would do the same in
> R.  So, if folks send you solutions off-list, please do post them
> back to the list.
>
> Regards,
> - Robert
> http://www.cwelug.org/downloads
> Help others get OpenSource software.  Distribute FLOSS
> for Windows, Linux, *BSD, and MacOS X with BitTorrent
>
> ______________________________________________
> [email protected] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>



--
Dave Armstrong
University of Maryland
Dept of Government and Politics
3140 Tydings Hall
College Park, MD 20742
Office: 2103L Cole Field House
Phone: 301-405-9735
e-mail: [EMAIL PROTECTED]
web: www.davearmstrong-ps.com

Facts are meaningless.  You can use facts to prove anything that's even
remotely true. - Homer Simpson

To this day, philosophers suffer from Plato's disease: the assumption that
reality fundamentally consists of
abstract essences best described by words or geometry. (In truth, reality is
largely a probabilistic affair best
described by statistics) - Steve Sailer "The Unexpected Uselessness of
Philosophy"

        [[alternative HTML version deleted]]

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to