-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
format_col and nested 1-column frames #6592
Labels
Comments
If we change the current internal function to the following, it works: format_list_item2 <- function(x, ...) {
if (is.null(x))
"[NULL]"
else if (is.atomic(x) || inherits(x, "formula"))
paste(c(format(head(x, 6L), ...), if (length(x) > 6L) "..."),
collapse = ",")
else if (!inherits(x, "data.frame") && has_format_method(x) && length(formatted <- format(x, ...)) == 1L) {
formatted
}
else {
paste0("<", class(x)[1L], paste_dims(x), ">")
}
}
vapply_1c(x, format_list_item2, ...)
# [1] "<data.frame[1x1]>" "<data.frame[1x1]>" "<data.frame[1x1]>" Is that simple enough? I'm happy to submit a PR to that effect. (I'd change the original |
I think registering |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
(This may be related to #5948, since nested frames is a common link.)
When debugging,
Where it is assumed that all return values from
vapply_1c
are expected to be strings.Note that this does not fail when the nested frames are more than one column, since
format_list_item.default
perhaps-naively useslength(format(..)) == 1
.I don't know if it makes sense to define
format_list_item.data.frame
as well to preclude this, or if there are better methods:This test was done with
data.table_1.16.2
, but it also fails withdata.table_1.15.2
, so it's not a recent breakage.sessionInfo()
The text was updated successfully, but these errors were encountered: