From a88f4ab6f59770f6d6ff289d54db8c506a9e6917 Mon Sep 17 00:00:00 2001 From: Barret Schloerke Date: Fri, 25 Jul 2025 14:58:55 -0400 Subject: [PATCH 1/2] docs(expect_shape): Fix duplicate/missing param docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Error: ``` Undocumented arguments in Rd file 'expect_shape.Rd' ‘ncol’ Duplicated \argument entries in Rd file 'expect_shape.Rd': ‘nrow’ ``` --- R/expect-shape.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/expect-shape.R b/R/expect-shape.R index 741bd086a..4f35d1156 100644 --- a/R/expect-shape.R +++ b/R/expect-shape.R @@ -8,7 +8,7 @@ #' @inheritParams expect_that #' @param ... Ignored. #' @param length Expected [length()] of `object`. -#' @param nrow,nrow Expected [nrow()]/[ncol()] of `object`. +#' @param nrow,ncol Expected [nrow()]/[ncol()] of `object`. #' @param dim Expected [dim()] of `object`. #' @family expectations #' @export From 32ffefef56188d2587e779101f66b3a19f3dccd5 Mon Sep 17 00:00:00 2001 From: Hadley Wickham Date: Fri, 25 Jul 2025 14:04:53 -0500 Subject: [PATCH 2/2] Just do it by hand --- man/expect_shape.Rd | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/man/expect_shape.Rd b/man/expect_shape.Rd index 064750fcd..9abb9da22 100644 --- a/man/expect_shape.Rd +++ b/man/expect_shape.Rd @@ -16,9 +16,7 @@ within a function or for loop. See \link{quasi_label} for more details.} \item{length}{Expected \code{\link[=length]{length()}} of \code{object}.} -\item{nrow}{Expected \code{\link[=nrow]{nrow()}} of \code{object}.} - -\item{ncol}{Expected \code{\link[=ncol]{ncol()}} of \code{object}.} +\item{nrow, ncol}{Expected \code{\link[=nrow]{nrow()}}/\code{\link[=ncol]{ncol()}} of \code{object}.} \item{dim}{Expected \code{\link[=dim]{dim()}} of \code{object}.} } @@ -26,6 +24,13 @@ within a function or for loop. See \link{quasi_label} for more details.} This is a generalization of \code{\link[=expect_length]{expect_length()}} to test the "shape" of more general objects like data.frames, matrices, and arrays. } +\examples{ +x <- matrix(1:9, nrow = 3) +expect_shape(x, length = 9) +expect_shape(x, nrow = 3) +expect_shape(x, ncol = 3) +expect_shape(x, dim = c(3, 3)) +} \seealso{ \code{\link[=expect_length]{expect_length()}} to specifically make assertions about the \code{\link[=length]{length()}} of a vector.