[R] sum specific rows in a data frame

Mohamed Lajnef Mohamed.lajnef at inserm.fr
Wed Apr 14 11:24:15 CEST 2010


Hi Arnaud,

Try  aggregate function

regards
M

arnaud Gaboury a écrit :
> I have a data frame called "pose":
>
>
>           DESCRIPTION QUANITY CLOSING.PRICE
> 1       WHEAT May/10        1        467.75
> 2       WHEAT May/10        2        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        3         78.13
> 7 COTTON NO.2 May/10        1         78.13
>
> I would like to sum the quantity for each category (i.e WHEAT and
> COTTON),but I have no idea how to write it in a simple manner. The number or
> rows will change every day.
> TY for any help.
>
> ______________________________________________
> R-help at 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.
>
>   


-- 


Mohamed Lajnef,IE 
INSERM U955 eq 15
Pôle de Psychiatrie
Hôpital CHENEVIER
40, rue Mesly
94010 CRETEIL Cedex FRANCE
Mohamed.lajnef at inserm.fr
tel : 01 49 81 31 31 (poste 18470)
Sec : 01 49 81 32 90
fax : 01 49 81 30 99 



More information about the R-help mailing list