[R] Merge records in the same dataframe

Vadlamani, Satish {FLNA} SATISH.VADLAMANI at fritolay.com
Thu Nov 5 22:15:46 CET 2009


Hi:

Suppose that I have a data frame as below

x1 x2 x3 ... x10 wk1 wk2 ... Wk208 (these are the column names)

For each record, x1, x2, x3 ... x10 are attributes. and wk1, wk2, ..., wk208 are the sales recoreded for this attribute combination. Suppose that now, that I want to do the following

1. Merge the data frame so that I have a new data frame grouped by values of x2 and x3 (for example). That is, if two records have the same values of x2 and x3, they should be summed.

I tried to look at merge, tapply etc. but did not see a fit with I want to do above.

Thanks in advance.

Satish




More information about the R-help mailing list