diff --git a/R/JoinKeys.R b/R/JoinKeys.R index e0d23e9ba..6c61e816b 100644 --- a/R/JoinKeys.R +++ b/R/JoinKeys.R @@ -353,14 +353,16 @@ JoinKeys <- R6::R6Class( # nolint #' @export #' #' @examples -#' join_keys() +#' # setting join keys #' join_keys( #' join_key("dataset_A", "dataset_B", c("col_1" = "col_a")), #' join_key("dataset_A", "dataset_C", c("col_2" = "col_x", "col_3" = "col_y")) #' ) -#' join_keys( -#' join_key("dataset_A", "dataset_B", c("col_1" = "col_a")) -#' ) +#' # or +#' jk <- join_keys() +#' jk["dataset_A", "dataset_B"] <- c("col_1" = "col_a") +#' jk["dataset_A", "dataset_C"] <- c("col_2" = "col_x", "col_3" = "col_y") +#' join_keys <- function(...) { x <- list(...) res <- JoinKeys$new() @@ -376,6 +378,7 @@ join_keys <- function(...) { #' @param dataset_1 (`character`) name of first dataset. #' @param dataset_2 (`character`) name of second dataset. #' @export +#' @keywords internal `[.JoinKeys` <- function(x, dataset_1, dataset_2 = NULL) { checkmate::assert_string(dataset_1) checkmate::assert_string(dataset_2, null.ok = TRUE) @@ -387,6 +390,7 @@ join_keys <- function(...) { #' @rdname sub-.JoinKeys #' @param value value to assign #' @export +#' @keywords internal `[<-.JoinKeys` <- function(x, dataset_1, dataset_2 = NULL, value) { checkmate::assert_string(dataset_1) checkmate::assert_string(dataset_2, null.ok = TRUE) @@ -404,6 +408,8 @@ join_keys <- function(...) { #' #' @export #' @examples +#' +#' # default CDISC join keys #' cdisc_join_keys(join_key("dataset_A", "dataset_B", c("col_1" = "col_a")), "ADTTE") #' cdisc_join_keys <- function(...) { diff --git a/man/join_keys.Rd b/man/join_keys.Rd index fb79dacba..0ac54305d 100644 --- a/man/join_keys.Rd +++ b/man/join_keys.Rd @@ -27,14 +27,18 @@ The \code{dataname} is extrapolated from the name (or fallback to the value its it's a \code{character(1)}). } \examples{ -join_keys() +# setting join keys join_keys( join_key("dataset_A", "dataset_B", c("col_1" = "col_a")), join_key("dataset_A", "dataset_C", c("col_2" = "col_x", "col_3" = "col_y")) ) -join_keys( - join_key("dataset_A", "dataset_B", c("col_1" = "col_a")) -) +# or +jk <- join_keys() +jk["dataset_A", "dataset_B"] <- c("col_1" = "col_a") +jk["dataset_A", "dataset_C"] <- c("col_2" = "col_x", "col_3" = "col_y") + + +# default CDISC join keys cdisc_join_keys(join_key("dataset_A", "dataset_B", c("col_1" = "col_a")), "ADTTE") } diff --git a/man/sub-.JoinKeys.Rd b/man/sub-.JoinKeys.Rd index b6649c8c0..6f9e2d872 100644 --- a/man/sub-.JoinKeys.Rd +++ b/man/sub-.JoinKeys.Rd @@ -21,3 +21,4 @@ \description{ Getter for JoinKeys that returns the relationship between pairs of datasets } +\keyword{internal}