-
Notifications
You must be signed in to change notification settings - Fork 985
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
data.table(x) != as.data.table(x) #877
Comments
@jamesonquinn please check related issue: #968 (comment) |
I've noted this in #944 to expand on this point under FAQ. The underlying idea is to facilitate creation of list columns in a straightforward manner. If you've a list and would like to create a data.table then use |
@jamesonquinn, Do you've any thoughts on how better to document it? Currently, the difference is stated clearly under "differences between data.frame and data.table. I can't think of a more appropriate section. I'm guessing you want to expand on the content? |
Just for reference, |
Here's the motivating example which had me mightily confused at first:
Now that I've explored this issue, I understand what's going on. But at the very least, there should be an entry in the faq about this.
The issue is that you might say data.table(listOne,listTwo) (or indeed, data.table(vectorOne,vectorTwo)) to create a two-column table, while as.data.table should only take one argument. Personally, I think the default here is wrong; it would make more sense, and be easier to troubleshoot bugs, if data.table(listOne) was the same as as.data.table(listOne), rather than being similar to data.table(listOne, listTwo).
This is touched on in the FAQ when it says "data.frame(list(1:2,"k",1:4)) creates 3 columns, data.table creates one list column." Still, I think that ideally the default should change: data.table with one argument should be the same as as.data.table. If not, this behavior should at least be better-documented.
The text was updated successfully, but these errors were encountered: