You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I see dcast throws an error when one submits an empty data.table. This appear to be consistent with an error that reshape2:::dcast throws with an empty data.frame, but inconsistent with how reshape deals with empty data.frames (returns an empty data.frame).
Any possibility for changing the dcast behavior to return an empty data.table?
Here's an example:
> require(data.table)
Loading required package: data.table
data.table 1.9.5 For help type ?data.table or https://github.com/Rdatatable/data.table/wiki
> test.dt <- data.table(ID=rep(1:2, each=2), X=rnorm(4), TIME=rep(1:2, 2))
> test.dt
ID X TIME
1: 1 0.5567229 1
2: 1 0.8330417 2
3: 2 0.2159679 1
4: 2 0.3763645 2
> dcast(subset(test.dt, ID==3), ID ~ TIME, value.var="X")
Error in dcast.data.table(subset(test.dt, ID == 3), ID ~ TIME, value.var = "X") :
Can not cast an empty data.table
The text was updated successfully, but these errors were encountered:
I agree with base::reshape's behaviour. However, data.table::dcast has to be consistent with reshape2::dcast, not base::reshape. If rehape2::dcast, changes its behaviour, then yes. But I doubt it's possible anymore.
I see dcast throws an error when one submits an empty data.table. This appear to be consistent with an error that reshape2:::dcast throws with an empty data.frame, but inconsistent with how reshape deals with empty data.frames (returns an empty data.frame).
Any possibility for changing the dcast behavior to return an empty data.table?
Here's an example:
Non-empty
Empty
The text was updated successfully, but these errors were encountered: