Skip to content
This repository has been archived by the owner on Jan 30, 2025. It is now read-only.

Commit

Permalink
Small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nfrerebeau committed Nov 6, 2024
1 parent fc2bb1f commit 7fe1558
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion R/assert.R
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ assert_unique <- function(x) {
#' @family checking methods
#' @export
assert_type <- function(x, expected, allow_empty = TRUE, allow_null = FALSE) {
if (is.null(x) && isTRUE(allow_null)) return(NULL)
if (is.null(x) && isTRUE(allow_null)) return(invisible(NULL))
if (isFALSE(allow_empty)) assert_filled(x)

arg <- deparse(substitute(x))
Expand Down
2 changes: 1 addition & 1 deletion R/seek.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
seek <- function(x, margin = 2, select = NULL, names = NULL, ...) {
assert_filled(x)
assert_length(margin, 1)
assert_type(names, "character", allow_null = TRUE)

dm <- dim(x)[[margin]]
nm <- dimnames(x)[[margin]]
if (is.null(nm)) return(NULL)

if (is.null(select)) {
if (!is.null(names)) {
assert_type(names, "character")
select <- function(i) match(names, i)
} else {
return(seq_len(dm))
Expand Down

0 comments on commit 7fe1558

Please sign in to comment.