diff --git a/NEWS.md b/NEWS.md index 57f68edb..3ee04f7f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,8 +1,23 @@ -# joyn (development version) +# joyn 0.2.0 -# joyn 0.1.6 +## Breaking changes -# joyn 0.1.5 +* Function `joyn::merge()` was replaced by `joyn::joyn()`. This is now the main function of the `joyn` package. + +* Arguments `allow.cartesian`, `yvars`, and `keep_y_in_x` have been deprecated. The latter two have been replaced by `y_vars_to_keep` and `keep_common_vars`, respectively. The new argument names bring more clarity about what they arguments do. + +## New features + +* New function `joyn::merge()` works as a mask for the `base::merge()` or `data.table::merge.data.table()`. `joyn::merge()` has the same features as the previous two, but includes the features of `joyn::joyn()`. + +* Messages style have been improved and categorize. See [message vignette](https://randrescastaneda.github.io/joyn/articles/messages.html) for more information. + +* New functions to mimic [dplyr joins](https://dplyr.tidyverse.org/reference/mutate-joins.html). The `joyn` variants have all the features for `joyn::joyn()` but lack some of the most advance features of `dplyr` joins like [`joyn::join_by()`](https://dplyr.tidyverse.org/reference/join_by.html) + + +## Minor improvements and fixes + +* Minor inconsistency bugs were fixed. # joyn 0.1.4 * update_NAs now could be FALSE even if update_values is TRUE diff --git a/R/info_display.R b/R/info_display.R index cff5f6a2..9aad77d4 100644 --- a/R/info_display.R +++ b/R/info_display.R @@ -3,7 +3,7 @@ #' @param msg_type character: one or more of the following: #' `r cli::format_inline("{.or {c('all', 'basic', type_choices())}}")` #' @param msg character vector to be parsed to [cli::cli_abort()]. Default is -#' NULL. It only works if `"err" %in% msg_type` +#' NULL. It only works if `"err" %in% msg_type`. This is an internal argument. #' #' @family messages #' @@ -11,18 +11,16 @@ #' @export #' #' @examples -#' # Storing msg with msg_type "info" -#' joyn:::store_msg("info", -#' ok = cli::symbol$tick, " ", -#' pale = "This is an info message") -#' -#' # Storing msg with msg_type "warn" -#' joyn:::store_msg("warn", -#' err = cli::symbol$cross, " ", -#' note = "This is a warning message") +#' library(data.table) +#' x1 = data.table(id = c(1L, 1L, 2L, 3L, NA_integer_), +#' t = c(1L, 2L, 1L, 2L, NA_integer_), +#' x = 11:15) #' +#' y1 = data.table(id = 1:2, +#' y = c(11L, 15L)) +#' df <- joyn(x1, y1, match_type = "m:1") +#' joyn_msg("basic") #' joyn_msg("all") - joyn_msg <- function(msg_type = getOption("joyn.msg_type"), msg = NULL) { @@ -75,6 +73,16 @@ joyn_msg <- function(msg_type = getOption("joyn.msg_type"), #' #' @return current message data frame invisibly #' @keywords internal +#' @examples +#' # Storing msg with msg_type "info" +#' joyn:::store_msg("info", +#' ok = cli::symbol$tick, " ", +#' pale = "This is an info message") +#' +#' # Storing msg with msg_type "warn" +#' joyn:::store_msg("warn", +#' err = cli::symbol$cross, " ", +#' note = "This is a warning message") store_msg <- function(type, ...) { # check input ---------- diff --git a/man/joyn_msg.Rd b/man/joyn_msg.Rd index aea66245..e887b1dc 100644 --- a/man/joyn_msg.Rd +++ b/man/joyn_msg.Rd @@ -11,7 +11,7 @@ joyn_msg(msg_type = getOption("joyn.msg_type"), msg = NULL) all, basic, info, note, warn, timing, or err} \item{msg}{character vector to be parsed to \code{\link[cli:cli_abort]{cli::cli_abort()}}. Default is -NULL. It only works if \code{"err" \%in\% msg_type}} +NULL. It only works if \code{"err" \%in\% msg_type}. This is an internal argument.} } \value{ returns data frame with message invisibly. print message in console @@ -20,16 +20,15 @@ returns data frame with message invisibly. print message in console display type of joyn message } \examples{ -# Storing msg with msg_type "info" -joyn:::store_msg("info", - ok = cli::symbol$tick, " ", - pale = "This is an info message") - -# Storing msg with msg_type "warn" -joyn:::store_msg("warn", - err = cli::symbol$cross, " ", - note = "This is a warning message") +library(data.table) +x1 = data.table(id = c(1L, 1L, 2L, 3L, NA_integer_), +t = c(1L, 2L, 1L, 2L, NA_integer_), +x = 11:15) +y1 = data.table(id = 1:2, + y = c(11L, 15L)) +df <- joyn(x1, y1, match_type = "m:1") +joyn_msg("basic") joyn_msg("all") } \seealso{ diff --git a/man/store_msg.Rd b/man/store_msg.Rd index 4d614e25..6a1de9b0 100644 --- a/man/store_msg.Rd +++ b/man/store_msg.Rd @@ -15,6 +15,17 @@ current message data frame invisibly \description{ Store joyn message to .joynenv environment } +\examples{ +# Storing msg with msg_type "info" +joyn:::store_msg("info", + ok = cli::symbol$tick, " ", + pale = "This is an info message") + +# Storing msg with msg_type "warn" +joyn:::store_msg("warn", + err = cli::symbol$cross, " ", + note = "This is a warning message") +} \seealso{ Messages functions \code{\link{clear_joynenv}()},