Skip to content

Commit 0e7f18a

Browse files
committed
be more thorough with truncating label lists
1 parent a502f6c commit 0e7f18a

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

R/layer.R

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -974,10 +974,8 @@ normalise_label <- function(label) {
974974
if (obj_is_list(label)) {
975975
# Ensure that each element in the list has length 1
976976
label[lengths(label) == 0] <- ""
977-
# Don't mess with call/formula
978-
if (!is.call(label[[1]])) {
979-
label[] <- lapply(label, `[`, 1)
980-
}
977+
truncate <- !vapply(label, is.call, logical(1)) # Don't mess with call/formula
978+
label[truncate] <- lapply(label[truncate], `[`, 1)
981979
}
982980
if (is.expression(label)) {
983981
# Classed expressions, when converted to lists, retain their class.

0 commit comments

Comments
 (0)