Hi,
You should send your data using dput() so that we can copy/paste into
the console.
That said, aggregate() or doBy::summaryBy() might do what you're looking
for.
HTH,
Ivan
Le 21-Apr-10 10:01, n.via...@libero.it a écrit :
Dear list
I have a question, I would like to get the following results but I dont know
how to do it:
I have a dataframe like this:
NC8 PROD X 1 X2
1423 P1 342 10
1564 G5 56 20
123 G5 3
4
1568 H2
6 10
7864 H2
5 72
5693 P3
7 43
What I would like to do is the sum of the X1 and X2 variables by PROD, namely
getting another dataframe which looks like the following
NC8 PROD X 1
X2
1423 P1 342 10
1564 G5 59 24
123 G5 59
24
1568 H2 11
82
7864 H2
11 82
5693 P3
7 43
In Sas I know a function called proc means that can do it.
How can I do this in R???
______________________________________________
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.
______________________________________________
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.