Skip to content

Commit

Permalink
Merge branch 'f-#244-rlang'. Closes #244
Browse files Browse the repository at this point in the history
- Use `rlang` functions (#244).
  • Loading branch information
krlmlr committed May 6, 2017
2 parents 21a40f5 + 2bd2dda commit 748cfe9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions R/tibble.R
Expand Up @@ -94,14 +94,14 @@ check_tibble <- function(x) {
}

# Types
is_1d <- vapply(x, is_1d, logical(1))
is_1d <- map_lgl(x, is_1d)
if (any(!is_1d)) {
invalid_df("Each variable must be a 1d atomic vector or list", x, !is_1d)
}

x[] <- lapply(x, strip_dim)
x[] <- map(x, strip_dim)

posixlt <- vapply(x, inherits, "POSIXlt", FUN.VALUE = logical(1))
posixlt <- map_lgl(x, inherits, "POSIXlt")
if (any(posixlt)) {
invalid_df("Date/times must be stored as POSIXct, not POSIXlt", x, posixlt)
}
Expand All @@ -115,7 +115,7 @@ recycle_columns <- function(x) {
}

# Validate column lengths
lengths <- vapply(x, NROW, integer(1))
lengths <- map_int(x, NROW)
max <- max(lengths)

bad_len <- lengths != 1L & lengths != max
Expand All @@ -125,7 +125,7 @@ recycle_columns <- function(x) {

short <- lengths == 1
if (max != 1L && any(short)) {
x[short] <- lapply(x[short], rep, max)
x[short] <- map(x[short], rep, max)
}

x
Expand Down
4 changes: 2 additions & 2 deletions R/utils.r
Expand Up @@ -39,11 +39,11 @@ safe_match <- function(x, table) {
}

stopc <- function(...) {
stop(..., call. = FALSE, domain = NA)
abort(paste0(...))
}

warningc <- function(...) {
warning(..., call. = FALSE, domain = NA)
warn(paste0(...))
}

nchar_width <- function(x) {
Expand Down

0 comments on commit 748cfe9

Please sign in to comment.