[datatable-help] dcast.data.table loses column classes when column is date

Arunkumar Srinivasan aragorn168b at gmail.com
Mon Jun 9 23:29:21 CEST 2014


Juan,

On how to report a bug:
1) Go to https://github.com and create an account, if you don't already have one.
2) Go to our project page, while signed in: https://github.com/Rdatatable/datatable
3) Click "Issues" on the right side of the page.
4) This issue doesn't already exist. So, hit "New issue" (green button on the right).
5) Provide a title. Fill the body - remember you can format code using Markdown (as well as Github flavoured markdown). For example, to write R-code, you can do:

```S
your R-code
```

The S is the lexer type (for highlighting code using Github flavoured markdown).
6) Add a label (equivalent of tag or tracker type in R-Forge) by clicking on "bug" on the right side. 
7) Preview your post, if you want to. Then click "Submit new issue".

---

On the bug itself: This is because `reshape2:::dcast` doesn't preserve attributes. And we wanted to be consistent with their result at the time of writing. 
However, since that time, `reshape2` has obtained newer implementation of "melt", written by Kevin Ushey, where attributes are preserved as long as all the columns that you're asking for to be "molten" are of the same type. But this doesn't happen for "factors" by default because that might break existing code - and therefore obtained a new argument "factorsAsStrings", IIUC. I personally find these things adding a layer of complexity. But that's the case with "melt". 

It's really hard to tell from reshape2's ?melt or ?cast what's the case regarding attributes. But my guess is that we should, starting with your post, try to define what's what and document it instead of relying entirely on being consistent with reshape2's behaviour, as we do already differ from reshape2 already slightly.

We're very much younger than reshape2's melt/cast. So, I think we might be able to rectify these things on consistency and rules relatively easier.

Arun

From: Juan Manuel Truppia jmtruppia at gmail.com
Reply: Juan Manuel Truppia jmtruppia at gmail.com
Date: June 9, 2014 at 10:13:05 PM
To: datatable-help at lists.r-forge.r-project.org datatable-help at lists.r-forge.r-project.org
Subject:  [datatable-help] dcast.data.table loses column classes when column is date  

Here is a reproducible example  

dcast.data.table(data = data.table(id = c(1,1,2,2), ty =  
c("a","b","a","b"), da = Sys.Date()), formula = id ~ ty)  

I don't know how to report a bug, if someone guides me, I'll be much obliged  

Thanks!  
_______________________________________________  
datatable-help mailing list  
datatable-help at lists.r-forge.r-project.org  
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/datatable-help/attachments/20140609/9ebc5f83/attachment-0001.html>


More information about the datatable-help mailing list