Skip to content

Commit c70ef2a

Browse files
Allow trailing commas in guides() and labs() (#4240)
1 parent feaa4bc commit c70ef2a

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

R/guides-.r

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
#' )
6565
#' }
6666
guides <- function(...) {
67-
args <- list(...)
67+
args <- list2(...)
6868
if (length(args) > 0) {
6969
if (is.list(args[[1]]) && !inherits(args[[1]], "guide")) args <- args[[1]]
7070
args <- rename_aes(args)

R/labels.r

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ update_labels <- function(p, labels) {
6868
#' labs(title = "title") +
6969
#' labs(title = NULL)
7070
labs <- function(..., title = waiver(), subtitle = waiver(), caption = waiver(), tag = waiver()) {
71-
args <- list2(..., title = title, subtitle = subtitle, caption = caption, tag = tag)
71+
# .ignore_empty = "all" is needed to allow trailing commas, which is NOT a trailing comma for dots_list() as it's in ...
72+
args <- dots_list(..., title = title, subtitle = subtitle, caption = caption, tag = tag, .ignore_empty = "all")
7273

7374
is_waive <- vapply(args, is.waive, logical(1))
7475
args <- args[!is_waive]

0 commit comments

Comments
 (0)