Skip to content

Commit 4a3ffff

Browse files
committed
inline is_facets()
1 parent abc62dd commit 4a3ffff

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

R/facet-.R

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,9 @@ simplify <- function(x) {
506506
}
507507

508508
as_facets <- function(x) {
509-
if (is_facets(x)) {
509+
is_facets <- is.list(x) && length(x) > 0 &&
510+
all(vapply(x, is_quosure, logical(1)))
511+
if (is_facets) {
510512
return(x)
511513
}
512514

@@ -535,17 +537,6 @@ f_as_facets <- function(f) {
535537
as_quosures(vars, env, named = TRUE)
536538
}
537539

538-
is_facets <- function(x) {
539-
if (!is.list(x)) {
540-
return(FALSE)
541-
}
542-
if (!length(x)) {
543-
return(FALSE)
544-
}
545-
all(vapply(x, is_quosure, logical(1)))
546-
}
547-
548-
549540
# When evaluating variables in a facet specification, we evaluate bare
550541
# variables and expressions slightly differently. Bare variables should
551542
# always succeed, even if the variable doesn't exist in the data frame:

0 commit comments

Comments
 (0)