Nice thing about R is there is more than one way of doing something:
> x
name ip Bsent Breceived
1 a 1 0.00 0.00
2 a 2 1.43 19.83
3 a 1 0.00 0.00
4 a 2 1.00 1.00
5 b 1 0.00 2.00
6 b 3 0.00 2.00
7 b 2 2.00 0.00
8 b
With your data set as the data.frame xx
library(reshape2)
xx <- melt(xx)
dcast(xx, name ~ variable, sum)
--- On Sun, 11/7/10, Mohan L wrote:
> From: Mohan L
> Subject: [R] help to sum up data frame
> To: r-help@r-project.org
> Received: Sunday, November 7, 2010, 8:59 AM
>
On Nov 7, 2010, at 8:59 AM, Mohan L wrote:
Dear All,
I have a data frame like this:
name ip Bsent Breceived
a 10.00 0.00
a 2 1.43 19.83
a 1 0.00 0.00
a 21.00 1.00
b 10.00
Dear All,
I have a data frame like this:
name ip Bsent Breceived
a 10.00 0.00
a 2 1.43 19.83
a 1 0.00 0.00
a 21.00 1.00
b 10.00 2.00
b 3 0.00 2.00
b
4 matches
Mail list logo