try this:
> x <- " IDval
+ 1 A 0.100
+ 2 B 0.001
+ 3 C -0.100
+ 4 A 0.200
+ "
> x <- read.table(textConnection(x), header=TRUE)
> (z <- tapply(x$val, x$ID, sum))
A B C
0.300 0.001 -0.100
> data.frame(ID=names(z), val=z)
IDval
A A 0.300
B B 0.001
C C -0.100
>
On Tue, 29 May 2007, Seth Falcon wrote:
> "Young Cho" <[EMAIL PROTECTED]> writes:
>
>> I have data.frame's with IDs and multiple columns. B/c some of IDs
>> showed up more than once, I need sum up colum values to creat a new
>> dataframe with unique ids.
>>
>> I hope there are some cheaper ways of
"Young Cho" <[EMAIL PROTECTED]> writes:
> I have data.frame's with IDs and multiple columns. B/c some of IDs
> showed up more than once, I need sum up colum values to creat a new
> dataframe with unique ids.
>
> I hope there are some cheaper ways of doing it... Because the
> dataframe is huge, it
I have data.frame's with IDs and multiple columns. B/c some of IDs showed up
more than once, I need sum up colum values to creat a new dataframe with
unique ids.
I hope there are some cheaper ways of doing it... Because the dataframe is
huge, it takes almost an hour to do the task. Thanks so muc