-
Notifications
You must be signed in to change notification settings - Fork 37
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
feat: Show missing values in red in glimpse()
#662
Conversation
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.
Thanks! Can you please add tests? There are some snapshot tests that also write the ANSI sequences to the snapshot file.
R/glimpse.R
Outdated
@@ -144,7 +144,10 @@ format_glimpse.default <- function(x, ...) { | |||
dims_out <- paste0(dims, collapse = " x ") | |||
paste0("<", class(x)[[1]], "[", dims_out, "]>") | |||
} else { | |||
format(x, trim = TRUE, justify = "none") | |||
out <- format(x, trim = TRUE, justify = "none") |
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.
This looks like an opportunity to remove the negation from the if
condition.
R/glimpse.R
Outdated
} | ||
out[is.na(x)] <- crayon_red(NA) |
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.
This looks like a pattern that we use in many places: assign a red NA
string to a vector where another vector has NA
values.
- Should this be a function?
- Should this be
crayon_red(NA)
orcrayon_red(out[is.na(x)])
instead?
glimpse()
I added tests and a |
Thanks! |
Changes to make glimpse show NAs in red., as brought up in #658.