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
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
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
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
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"))
5 matches
Mail list logo