[R] data frame colnames through ddply

Arnaud Gaboury arnaud.gaboury at a2ct2.com
Thu Feb 23 18:34:31 CET 2012


Dear list,

I am trying to pass data frame colnames through ddply without sucess.

Here is my command:

>exportfile<-ddply(exportfile,c("Product","Price"),summarise,Nbr.Lots=sum(Filled.Qty))

exportfile is a df. I want to apply summarise to Product and Price columns and sum the Filled.Qty column and renamed it Nbr.Lots. This line works. 

What I would like is changing the col names in the same line, thus avoiding another line with 
>colnames(exportfile)<-c("Contract","Price","Nbr.Lots")

Is there a possibility to change my col names in the same line?

TY



Arnaud Gaboury
 
A2CT2 Ltd.



More information about the R-help mailing list