From 1ec55a2e2e31280c7c7a56e92af202a1df74d7f0 Mon Sep 17 00:00:00 2001 From: Josiah Parry Date: Tue, 22 Oct 2024 14:47:07 -0400 Subject: [PATCH 1/4] document that rcrds require a format method --- R/type-rcrd.R | 3 +++ 1 file changed, 3 insertions(+) diff --git a/R/type-rcrd.R b/R/type-rcrd.R index faa3a5888..808b1c10b 100644 --- a/R/type-rcrd.R +++ b/R/type-rcrd.R @@ -12,6 +12,9 @@ #' (same sizes), and contain uniquely named vectors (at least #' one). `fields` is validated with [df_list()] to ensure uniquely #' named vectors. +#' @details +#' A new rcrd class created with [new_rcrd()] will not have a [format()] method. +#' New classes must implement their own [format()] method. See [Record-style objects](https://vctrs.r-lib.org/articles/s3-vector.html?q=record#record-style-objects) for more. #' @param ... Additional attributes #' @param class Name of subclass. #' @export From 95db5ae65b60e1b99c4c3dbae3b3dc62d57b6708 Mon Sep 17 00:00:00 2001 From: Josiah Parry Date: Wed, 23 Oct 2024 11:16:01 -0700 Subject: [PATCH 2/4] address PR requestions --- R/type-rcrd.R | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/R/type-rcrd.R b/R/type-rcrd.R index 808b1c10b..0800a3fa8 100644 --- a/R/type-rcrd.R +++ b/R/type-rcrd.R @@ -7,14 +7,17 @@ #' classes that can naturally be decomposed into multiple vectors of the same #' length, like [POSIXlt], but where the organisation should be considered #' an implementation detail invisible to the user (unlike a [data.frame]). +#' +#' @details +#' Record-style objects created with [new_rcrd()] do not have a default +#' [format()] method. See [Record-style objects](https://vctrs.r-lib.org/articles/s3-vector.html?q=record#record-style-objects +#' for more details on implementing other methods. #' #' @param fields A list or a data frame. Lists must be rectangular #' (same sizes), and contain uniquely named vectors (at least #' one). `fields` is validated with [df_list()] to ensure uniquely #' named vectors. -#' @details -#' A new rcrd class created with [new_rcrd()] will not have a [format()] method. -#' New classes must implement their own [format()] method. See [Record-style objects](https://vctrs.r-lib.org/articles/s3-vector.html?q=record#record-style-objects) for more. +#' #' @param ... Additional attributes #' @param class Name of subclass. #' @export From 756f66b494d806a786163c834fd04a2582c95013 Mon Sep 17 00:00:00 2001 From: Josiah Parry Date: Wed, 23 Oct 2024 14:21:41 -0400 Subject: [PATCH 3/4] Update R/type-rcrd.R --- R/type-rcrd.R | 1 - 1 file changed, 1 deletion(-) diff --git a/R/type-rcrd.R b/R/type-rcrd.R index 0800a3fa8..e62775b8f 100644 --- a/R/type-rcrd.R +++ b/R/type-rcrd.R @@ -17,7 +17,6 @@ #' (same sizes), and contain uniquely named vectors (at least #' one). `fields` is validated with [df_list()] to ensure uniquely #' named vectors. -#' #' @param ... Additional attributes #' @param class Name of subclass. #' @export From 0fe5bce73e9924abeabd7f1dc0cbcdb48a7c6485 Mon Sep 17 00:00:00 2001 From: Lionel Henry Date: Mon, 28 Oct 2024 14:26:22 +0100 Subject: [PATCH 4/4] Tweak --- R/type-rcrd.R | 9 +++++---- man/new_rcrd.Rd | 6 ++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/R/type-rcrd.R b/R/type-rcrd.R index e62775b8f..c45728549 100644 --- a/R/type-rcrd.R +++ b/R/type-rcrd.R @@ -7,11 +7,12 @@ #' classes that can naturally be decomposed into multiple vectors of the same #' length, like [POSIXlt], but where the organisation should be considered #' an implementation detail invisible to the user (unlike a [data.frame]). -#' +#' #' @details -#' Record-style objects created with [new_rcrd()] do not have a default -#' [format()] method. See [Record-style objects](https://vctrs.r-lib.org/articles/s3-vector.html?q=record#record-style-objects -#' for more details on implementing other methods. +#' Record-style objects created with [new_rcrd()] do not do much on their own. +#' For instance they do not have a default [format()] method, which means printing +#' the object causes an error. See [Record-style objects](https://vctrs.r-lib.org/articles/s3-vector.html?q=record#record-style-objects +#' for details on implementing methods for record vectors. #' #' @param fields A list or a data frame. Lists must be rectangular #' (same sizes), and contain uniquely named vectors (at least diff --git a/man/new_rcrd.Rd b/man/new_rcrd.Rd index 62f1b3238..05705629d 100644 --- a/man/new_rcrd.Rd +++ b/man/new_rcrd.Rd @@ -25,4 +25,10 @@ classes that can naturally be decomposed into multiple vectors of the same length, like \link{POSIXlt}, but where the organisation should be considered an implementation detail invisible to the user (unlike a \link{data.frame}). } +\details{ +Record-style objects created with \code{\link[=new_rcrd]{new_rcrd()}} do not do much on their own. +For instance they do not have a default \code{\link[=format]{format()}} method, which means printing +the object causes an error. See \link{Record-style objects}(https://vctrs.r-lib.org/articles/s3-vector.html?q=record#record-style-objects +for details on implementing methods for record vectors. +} \keyword{internal}