What does this warning message"recycled with remainder" mean In R?

Tushar B

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.

Simon.S.A.

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.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

What does NSObject.BroadSystemFontWeights warning message mean?

From Dev

What does this webrtc warning mean?

From Dev

What does this warning in PyCharm mean?

From Dev

what does this clamAV message mean?

From Dev

What does this terminal message mean?

From Dev

What does this error message mean?

From Dev

What does %*% mean in R

From Dev

What does %>% mean in R

From Dev

What does %*% mean in R

From Dev

Installshield Warning -6487: what does it mean

From Java

What does the warning "redirecting to" actually mean?

From Dev

What does "warning: nm: no name list" mean?

From Dev

What does this warning mean in corona sdk console?

From Dev

What does it mean to send a message to a thread?

From Dev

What does this "Message: Undefined property: stdClass" mean?

From Dev

What does the message "unreachable entry point" mean?

From Dev

What does this BSOD error message mean?

From Dev

What does this Pdesurf error message mean?

From Dev

What does this logcat error message mean?

From Dev

What does this "Message: Undefined property: stdClass" mean?

From Dev

What does the following kernel message mean?

From Dev

What does this warning mean and what should I do to fix it?

From Java

What does %>% function mean in R?

From Dev

What does character mean in R?

From Dev

What does !r mean in Python?

From Dev

What does `[$'\r\n']` mean?

From Dev

What does "list(...)" mean in R?

From Dev

What does "CL" mean in a commit message? What does it stand for?

From Dev

What does "WARNING: not changing user" mean in Neo4j?