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
evaluate as expected. This is caused from these lines of as.data.table.list function data.table.R:
n = vapply(x, length, 0L)
mn = max(n)
x = copy(x)
if (any(n<mn))
for (i in which(n<mn)) {
if (!is.null(x[[i]])) {# avoids warning when a list element is NULL
# Implementing FR #4813 - recycle with warning when nr %% nrows[i] != 0L
if (mn %% n[i] != 0)
warning("Item ", i, " is of size ", n[i], " but maximum size is ", mn, " (recycled leaving a remainder of ", mn%%n[i], " items)")
x[[i]] = rep(x[[i]], length.out=mn)
}
}
I believe the following happens:
x <- as.list(dt["c", list(id, var), nomatch=0L])
x$var <- max(x$var) # to simulate the internal process
n = vapply(x, length, 0L)
mn = max(n)
if (any(n<mn))
for (i in which(n<mn)) {
if (!is.null(x[[i]])) {# avoids warning when a list element is NULL
# Implementing FR #4813 - recycle with warning when nr %% nrows[i] != 0L
if (mn %% n[i] != 0) # <----------------- HERE
warning("Item ", i, " is of size ", n[i], " but maximum size is ", mn, " (recycled leaving a remainder of ", mn%%n[i], " items)")
x[[i]] = rep(x[[i]], length.out=mn)
}
}
# Error in if (mn%%n[i] != 0) warning("Item ", i, " is of size ", n[i], :
# missing value where TRUE/FALSE needed
1L %% 0L is NA, hence the error. In fact, if there are no zero length columns in the result it works
Even though I believe that the result of the last expression should be Empty data.table (0 rows) of 1 col: check. If any vector has zero length, can't as.data.table.list just set the table rows to zero? I don't think there is a case when a column has zero length and i evaluates to a positive (non zero) number of rows.
Thanks,
Michele.
The text was updated successfully, but these errors were encountered:
Please consider:
This happens only generating a brand-new column and not when simply selecting existing ones or when 'aggregation function' are not used. These
evaluate as expected. This is caused from these lines of
as.data.table.list
function data.table.R:I believe the following happens:
1L %% 0L
is NA, hence the error. In fact, if there are no zero length columns in the result it worksEven though I believe that the result of the last expression should be
Empty data.table (0 rows) of 1 col: check
. If any vector has zero length, can'tas.data.table.list
just set the table rows to zero? I don't think there is a case when a column has zero length andi
evaluates to a positive (non zero) number of rows.Thanks,
Michele.
The text was updated successfully, but these errors were encountered: