Skip to content

Commit 4739a12

Browse files
committed
inline is_column_vec() and better name for validate_column_vec()
1 parent e75c6d6 commit 4739a12

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

R/utilities.R

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -342,19 +342,17 @@ is_unique <- function(x) vec_unique_count(x) == 1L
342342

343343
# Check inputs with tibble but allow column vectors (see #2609 and #2374)
344344
as_gg_data_frame <- function(x) {
345-
x <- lapply(x, validate_column_vec)
345+
x <- lapply(x, drop_column_vec)
346346
data_frame0(!!!x)
347347
}
348-
validate_column_vec <- function(x) {
349-
if (is_column_vec(x)) {
348+
349+
drop_column_vec <- function(x) {
350+
dims <- dim(x)
351+
if (length(dims) == 2L && dims[[2]] == 1L) {
350352
dim(x) <- NULL
351353
}
352354
x
353355
}
354-
is_column_vec <- function(x) {
355-
dims <- dim(x)
356-
length(dims) == 2L && dims[[2]] == 1L
357-
}
358356

359357
# Parse takes a vector of n lines and returns m expressions.
360358
# See https://github.com/tidyverse/ggplot2/issues/2864 for discussion.

0 commit comments

Comments
 (0)