-
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
Add condense option to print.col_spec #468
Add condense option to print.col_spec #468
Conversation
out <- col_spec_standardise("a,b,c,d\n1,2,3,4") | ||
expect_output(print(out, condense = TRUE), | ||
regex_escape( | ||
"cols(.default = col_integer() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it might be easier to consistently put each argument on its own line
I agree that it's probably useful enough to export |
#' @export | ||
#' @examples | ||
#' df <- read_csv(system.file("mtcars.csv", package = "readr")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please use the new readr_example()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure thing, my system.file call was wrong anyway ;)
|
} | ||
|
||
#' @export | ||
format.col_spec <- function(x, n = Inf, condense = FALSE, ...) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about this logic. Maybe it should be condense = NULL
, then condense <- condense %||% length(x$cols) > n
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh but that would make the logic below more complicated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok that works for me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think your suggestion is better, previously there was no way to explicitly force the output to be condensed (other than calling condense_spec()) directly.
LGTM - I'm fine with |
LGTM |
[ci skip]
[ci skip]
6543267
to
e3ed26c
Compare
Not sure if we want to export
condense_spec()
, I could see it being useful though, so we may.Fixes #466