Plyr is 1.6 (latest CRAN), data.table is 1.6.3 (latest CRAN), and R is 2.12.1 (can't have a newer version due to custom work build).
The reason I'm doing it is more for code readability than anything. If multiple := was supported already I could make what I'm doing look not too bad, but as it is now what I'm doing is more obvious as a plyr statement. Namely I am doing a by command that changes the results of multiple variables at once (rescaling them), so if I were to do it with data.table I'd have to redo the by part for each variable separately. And the data at for this isn't really so big to worry about it at the moment. Digging through the plyr code there isn't anything obvious that would cause this to happen. And I'm unable to get this bug to happen any other way so far. On 4 August 2011 18:34, Short, Tom <[email protected]> wrote: > Chris, I can't replicate that. What versions of R, data.table, and plyr > are you using? > > As an aside, why do you need ddply in the first place? It seems > data.tables would be faster for that sort of thing. > > - Tom > > > > >> -----Original Message----- >> From: [email protected] >> [mailto:[email protected]] On >> Behalf Of Chris Neff >> Sent: Thursday, August 04, 2011 18:13 >> To: [email protected] >> Subject: [datatable-help] IDate somehow gets converted to numeric? >> >> This was kind of hard to track down. An example: >> >> > DT <- data.table(date=as.IDate(rep("2010-01-01",10)),x=1:10) >> >> > DT <- as.data.frame(DT) >> >> > str(DT) >> 'data.frame': 10 obs. of 2 variables: >> $ date:Classes 'IDate', 'Date' int [1:10] 14610 14610 14610 >> 14610 14610 14610 14610 14610 14610 14610 >> $ x : int 1 2 3 4 5 6 7 8 9 10 >> >> > DT2 <- ddply(DT, c("date", "x"), identity) >> >> > str(DT2) >> 'data.frame': 10 obs. of 2 variables: >> $ date:Classes 'IDate', 'Date' num [1:10] 14610 14610 14610 >> 14610 14610 ... >> $ x : int 1 2 3 4 5 6 7 8 9 10 >> >> >> As you can see int has changed to num here. If I try to >> convert back to a data table and key on date again: >> >> > DT2 <- as.data.table(DT2) >> > key(DT2)="date" >> Error in setkey("x", value) : >> Column 'date' cannot be auto converted to integer without >> losing information. >> >> Whereas converting DT back to a data table and keying on date >> works fine. Bug? >> >> -Chris >> _______________________________________________ >> datatable-help mailing list >> [email protected] >> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/d > atatable-help >> > _______________________________________________ datatable-help mailing list [email protected] https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
