We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a502f6c commit 0e7f18aCopy full SHA for 0e7f18a
R/layer.R
@@ -974,10 +974,8 @@ normalise_label <- function(label) {
974
if (obj_is_list(label)) {
975
# Ensure that each element in the list has length 1
976
label[lengths(label) == 0] <- ""
977
- # Don't mess with call/formula
978
- if (!is.call(label[[1]])) {
979
- label[] <- lapply(label, `[`, 1)
980
- }
+ truncate <- !vapply(label, is.call, logical(1)) # Don't mess with call/formula
+ label[truncate] <- lapply(label[truncate], `[`, 1)
981
}
982
if (is.expression(label)) {
983
# Classed expressions, when converted to lists, retain their class.
0 commit comments