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 am using a magnificent data.table package version 1.9.4. Thanks a lot for such useful software masterpiece.
In example below, data.table complains that columns o and n are of different length while I don't see a reason why they should be different.
library(data.table)
tr = data.table(k = c(0, 2, 3, 7), o = "b", key = "k")
en = data.table(k = c(1, 2, 3, 4, 5), n = c("n1", "n2", "n3", "n4", "n5"), key = "k")
tr_copy = copy(tr)
## Gives a warning about recycling and produces wrong result,
## why `o` and `n` of a different length, aren't they supposed to be equal after join?
tr_copy[en, o := n, nomatch = 0]
## Warning message: In `[.data.table`(tr_copy, en, `:=`(o, n), nomatch = 0) : Supplied 2 items to be assigned to 5 items of column 'o' (recycled leaving remainder of 1 items).
#######################################################
#######################################################
tr_copy = copy(tr)
## No error and gives correct result, seems counterintuitive
tr[en, o := n, nomatch = NA]
The text was updated successfully, but these errors were encountered:
I am also extensively using this wonderful package and I encoutered the same kind of strange behaviour, but in addition to what riabusan said I would add two things :
1) First, sometimes you don't even get a warning which makes it really tricky. For instance if I slightly modify riabusan's example by adding 0, 6, 7 and the corresponding n0, n6, n7 into his "en" variable it gives :
Hi,
I am using a magnificent data.table package version 1.9.4. Thanks a lot for such useful software masterpiece.
In example below, data.table complains that columns
o
andn
are of different length while I don't see a reason why they should be different.The text was updated successfully, but these errors were encountered: