[EMAIL PROTECTED]
Cc: r-help@stat.math.ethz.ch
Sent: Saturday, April 15, 2006 9:35:46 AM
Subject: Re: [R] matching identical row names
Dear Srinivas,
Your data are likely in a data frame rather than a matrix (since the columns
are heterogeneous), and name is a variable, not the row names
] On Behalf Of John Kane
Sent: Sunday, April 16, 2006 10:29 AM
To: John Fox; Srinivas Iyyer
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] matching identical row names
Dear Dr. Fox
Your reply to Sirinivas Iyyar was most helpful to me. I am
trying to collapse some categories of a data.frame
@stat.math.ethz.ch; Srinivas Iyyer [EMAIL PROTECTED]
Sent: Sunday, April 16, 2006 11:51:51 AM
Subject: RE: [R] matching identical row names
Dear John,
You can use aggregate(), also described in my suggestion to Sirinivas:
aggregate(Data[, 4:6], Data[1:3], sum)
Prog Sub.Program Job V1 V2 V3
11
aggregate(DF[,-1], DF[, 1, drop = FALSE], mean)
On 4/15/06, Srinivas Iyyer [EMAIL PROTECTED] wrote:
dear group,
i have a sample matrix
name v1 v2 v3 v4
cat 1011 12 15
dog 3 12 10 14
cat 9 12 12 15
cat 5 12 10 11
dog 12113 123 31
Dear Srinivas,
Your data are likely in a data frame rather than a matrix (since the columns
are heterogeneous), and name is a variable, not the row names of the data
frame.
There are several ways to do what you want; one simple way, assuming that
the data are in a data frame named Data, is