Re: [R] ddply - how to transform df column "in place"

2011-08-23 Thread David Winsemius
On Aug 23, 2011, at 6:38 PM, David Winsemius wrote: On Aug 23, 2011, at 6:16 PM, jjap wrote: Dear R-users, I am trying to get the plyr syntax right, without much success. Given: d<- data.frame(cbind(x=1,y=seq(20100801,20100830,1))) names(d)<-c("first", "daterep") d2<-d # I can convert the

Re: [R] ddply - how to transform df column "in place"

2011-08-23 Thread David Winsemius
On Aug 23, 2011, at 6:16 PM, jjap wrote: Dear R-users, I am trying to get the plyr syntax right, without much success. Given: d<- data.frame(cbind(x=1,y=seq(20100801,20100830,1))) names(d)<-c("first", "daterep") d2<-d # I can convert the daterep column in place the classic way: d$daterep<-as

Re: [R] ddply - how to transform df column "in place"

2011-08-23 Thread Justin Haynes
Jean, Ista is right, but: In your function you are asking as.Date to convert the whole data.frame df rather than just your daterep column. out<-ddply(d2, .(daterep), function(df) as.Date(strptime(df$daterep,format='%Y%m%d'))) >str(out) 'data.frame':30 obs. of 2 variables: $ daterep: num 2

Re: [R] ddply - how to transform df column "in place"

2011-08-23 Thread Ista Zahn
Hi Jean, On Tue, Aug 23, 2011 at 6:16 PM, jjap wrote: > Dear R-users, > > I am trying to get the plyr syntax right, without much success. > > Given: > d<- data.frame(cbind(x=1,y=seq(20100801,20100830,1))) > names(d)<-c("first", "daterep") > d2<-d > > # I can convert the daterep column in place th

[R] ddply - how to transform df column "in place"

2011-08-23 Thread jjap
Dear R-users, I am trying to get the plyr syntax right, without much success. Given: d<- data.frame(cbind(x=1,y=seq(20100801,20100830,1))) names(d)<-c("first", "daterep") d2<-d # I can convert the daterep column in place the classic way: d$daterep<-as.Date(strptime(d$daterep, format="%Y%m%d"))