Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions R/labeller.r
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,8 @@ as_labeller <- function(x, default = label_value, multi_line = TRUE) {
x(labels)
} else if (is.function(x)) {
default(lapply(labels, x))
} else if (is.formula(x)) {
default(lapply(labels, as_function(x)))
} else if (is.character(x)) {
default(lapply(labels, function(label) x[label]))
} else {
Expand Down Expand Up @@ -433,7 +435,10 @@ labeller <- function(..., .rows = NULL, .cols = NULL,
if (!is.null(keep.as.numeric)) {
.Deprecated(old = "keep.as.numeric")
}

dots <- list(...)


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can I get you to revert these superfluous changed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My apologies. Fixed in 6d488b6.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No apology needed - thanks for your work on this

.default <- as_labeller(.default)

function(labels) {
Expand Down
1 change: 1 addition & 0 deletions R/scale-.r
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ discrete_scale <- function(aesthetics, scale_name, palette, name = waiver(),

check_breaks_labels(breaks, labels)

if (is.formula(labels)) labels <- as_function(labels)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry this is mostly my fault for getting in your way with #4427, but the allow_lambda() statements below already capture formulas as functions, so this line has become unnecessary. Apologies!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's OK, thank you for your contribution. In the up-to-date commit, the line is removed. I accidentally retained both solutions during the merge conflict resolution.

# Convert formula input to function if appropriate
limits <- allow_lambda(limits)
breaks <- allow_lambda(breaks)
Expand Down