-
Notifications
You must be signed in to change notification settings - Fork 286
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
Suggestion: change default value of condense to FALSE in print.col_spec() #1478
Comments
On a related matter, I also think that cols_condense <- function (x, .default = NULL) {
types <- vapply(x$cols, function(xx) class(xx)[[1]], character(1))
if (is.null(.default)) {
counts <- table(types)
most_common <- names(counts)[counts == max(counts)][[1]]
x$default <- x$cols[types == most_common][[1]]
x$cols <- x$cols[types != most_common]
} else {
x$default <- .default
x$cols <- x$cols[types != class(.default)[[1]]]
}
x
} |
This might be surprising to you, but it's been this way for many years now, so changing it at this point is likely to increase new surprise, not decrease it. |
How about the second suggestion? The initial motivation for me was looking at data sets with many columns, many of which contain mostly missing data. The readr/vroom guess for such columns is likely to be logical and those are exactly the ones I want to manually specify. So if I could set the default in cols_condense to the most common non-logical column type, then it leaves me with a more manageable list of the columns that I really need to deal with. I'm not sure if I have explained that well, but in general it seems like a useful feature to me that shouldn't break anyone's pre-existing code. |
I find the default behavior pretty surprising/confusing for a print method. See the example below to see what I mean. Would it break anything else if this were changed?
The text was updated successfully, but these errors were encountered: