Skip to content

Commit 077b268

Browse files
committed
add comments
1 parent 9384f1d commit 077b268

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

R/layer.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -971,10 +971,13 @@ normalise_label <- function(label) {
971971
return(NULL)
972972
}
973973
if (obj_is_list(label)) {
974+
# Ensure that element in the list has length 1
974975
label[lengths(label) == 0] <- ""
975976
labels <- lapply(labels, `[`, i)
976977
}
977978
if (is.expression(label)) {
979+
# Subclasses expressions, when converted to lists, retain their class.
980+
# The unclass is needed to properly treat it as a vctrs-compatible list.
978981
label <- unclass(as.list(label))
979982
}
980983
label

0 commit comments

Comments
 (0)