-
Notifications
You must be signed in to change notification settings - Fork 1k
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
setDT on DF will make data.table class as leading, closes #1078 #1089
Conversation
Why is this more desirable? If you want data.table methods to override methods for classes other than |
@gsee yes I would prefer to remove |
I don't think we should be masking other classes (and retaining them). I agree with @gsee. It's due to another FR long back, #64, that we preserve class, and I think this is the right behaviour (even though the FR is about retaining other classes that inherits from data.table). I don't understand why require(data.table)
require(dplyr)
dt = data.table(x=1:5, y=6:10)
tbl = tbl_dt(dt)
dt
# x y
# 1: 1 6
# 2: 2 7
# 3: 3 8
# 4: 4 9
# 5: 5 10
class(dt)
# [1] "data.table" "data.frame"
class(tbl)
# [1] "tbl_dt" "tbl" "data.table" "data.frame"
I've no idea how to fix this without removing the old feature. If anyone else has, feel free to issue a PR or share it here. |
Interesting. I think I like the current behavior of However, I'm not sure if I like the behavior from FR #64. Suppose I need to create a normalization layer -- I'm getting data from lots of different providers and each of them gives it to me in a different format. So, I create an object that has exactly the information that is common among all of them that I need for my business case. I'll class that object as FR #64 broke that because a subsetted "myBusinessClass" object is still a "myBusinessClass" object. In order to work around FR #64, I'd need to write more code... maybe an |
I guess the behavior that came out of FR #64 is consistent with base R.
|
I think dplyr is doing the wrong thing here. I'm not familiar with dplyr, but it almost seems like you actually want To be most consistent with base R, I think Removing classes on coercion is consistent with base R
|
@gsee I find it strange to have class definitions based on some columns being present or absent. I agree that @jangorecki do you think you can implement this in a squashed PR (for both |
ae24a0b
to
dfffee5
Compare
I've updated my branch, I see it went pretty bad cause I've squashed a commit which was pulling recent changes from data.table master :) |
@jangorecki it's cases like those that I was afraid of. I find it quite useful in retaining classes. I'd suggest putting this on hold for now. |
Closing PR as it breaks current tests. Still there is issue #1078 so we can address it later somehow. |
It simply put
data.table
class at first inclass
vector.Previous behavior was a bit different, putting
data.table
just beforedata.frame
, so this should be kept in mind after that change.