Thank you for your help. The best I have found is to use the ddply function.

> pose
          DESCRIPTION QUANITY CLOSING.PRICE
1       WHEAT May/10        1        467.75
2       WHEAT May/10        1        467.75
3       WHEAT May/10        1        467.75
4       WHEAT May/10        1        467.75
5 COTTON NO.2 May/10        1         78.13
6 COTTON NO.2 May/10        1         78.13
7 COTTON NO.2 May/10        1         78.13

> library(plyr)
> op=ddply(pose, c("DESCRIPTION","CLOSING.PRICE"),summarise, POSITION=
sum(QUANITY))
> op
          DESCRIPTION CLOSING.PRICE POSITION
1 COTTON NO.2 May/10          78.13        3
2       WHEAT May/10         467.75        4

Op is a data.frame object.The trick is done!



***************************
Arnaud Gaboury
Mobile: +41 79 392 79 56
BBM: 255B488F

______________________________________________
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.

Reply via email to