Warning message: In as.data.table.list(x, keep.rownames = keep.rownames, check.names = check.names, : Item 2 has 1650197 rows but longest item has 1667524; recycled with remainder.
This warning arises when R is given some form of list input to produce some form of list output but the length of the input and output lengths do not match. In these cases, R repeats and reuses the shorter list as appropriate.
See the documentation here: "If a list is supplied, each element is converted to a column in the data.table with shorter elements recycled automatically."
However, if the longer list is not a multiple of the length of the shorter list then the difference in length lists is unlikely to be deliberate, hence this warning.
Some examples:
> library(data.table)
> example1 = list(x = c(1,2,3,4,5,6), y = 3)
> as.data.table(example1)
x y
1: 1 3
2: 2 3
3: 3 3
4: 4 3
5: 5 3
6: 6 3
> example2 = list(x = c(1,2,3,4,5,6), y = c('a','b'))
> as.data.table(example2)
x y
1: 1 a
2: 2 b
3: 3 a
4: 4 b
5: 5 a
6: 6 b
In both of these examples, the x
and y
lists are of different lengths, so the y
list has been repeated. This produces no warning as y
is length 1 or 2 which is a multiple of x
which is length 6.
> example3 = list(x = c(1,2,3,4,5,6), y = c('a','b','c','d'))
> as.data.table(example3)
x y
1: 1 a
2: 2 b
3: 3 c
4: 4 d
5: 5 a
6: 6 b
Warning message:
In as.data.table.list(example3) :
Item 2 has 4 rows but longest item has 6; recycled with remainder.
But this example x
is length 6 and y
is length 4. So only the first two terms of y
have been repeated when creating the data table. R gives a warning as not every term in y
has been reused the same number of times.
In your example instead of lengths 6 and 4, you have columns of length 1650197 and 1667524. As it is unlikely (but possible) that you wanted to repeat the first 17327 entries (1667524 - 1650197) of the shorter column, R gives you a warning to prompt to you check your input columns.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments