diff --git a/DESCRIPTION b/DESCRIPTION index 025b613..c7ebb37 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -7,7 +7,7 @@ Authors@R: person("Benjamin", "Elbers", email = "elbersb@gmail.com", Description: Provides feedback about 'dplyr' and 'tidyr' operations. License: MIT + file LICENSE Imports: dplyr, tidyr, glue, clisymbols -Suggests: testthat, covr, lintr, nycflights13 +Suggests: testthat, covr, lintr Encoding: UTF-8 LazyData: true URL: https://github.com/elbersb/tidylog/ diff --git a/NEWS.md b/NEWS.md index e31f18c..d164ef8 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,5 @@ # 0.1.0.9000 +- added detailed merge information for joins (#25) - added supoort for tidyr functions: gather, spread (thanks @WilDoane), drop_na (@jackhannah95), fill and replace_na - use clisymbols for ellipsis - add number of remaining rows to filter (#23) diff --git a/R/join.R b/R/join.R index 6f187b8..e3117be 100644 --- a/R/join.R +++ b/R/join.R @@ -9,9 +9,12 @@ #' @return see \link[dplyr:join]{inner_join} #' @examples #' left_join(dplyr::band_members, dplyr::band_instruments, by = "name") -#' #> left_join: added 0 rows and added one column (plays) -#' full_join(dplyr::band_members, dplyr::band_instruments, by = "name") -#' #> full_join: added one row and added one column (plays) +#' #> left_join: added one column (plays) +#' #> > rows only in x 1 +#' #> > rows only in y (1) +#' #> > matched rows 2 +#' #> > === +#' #> > rows total 3 #' @import dplyr #' @export inner_join <- function(x, y, by = NULL, ...) { @@ -68,9 +71,9 @@ log_join <- function(x, y, by, .fun, .funname, ...) { cols_x <- x[, keys$x, drop = FALSE] cols_y <- y[, keys$y, drop = FALSE] - only_in_x = suppressMessages(dplyr::anti_join(cols_x, cols_y, + only_in_x <- suppressMessages(dplyr::anti_join(cols_x, cols_y, by = stats::setNames(keys$y, keys$x))) - only_in_y = suppressMessages(dplyr::anti_join(cols_y, cols_x, + only_in_y <- suppressMessages(dplyr::anti_join(cols_y, cols_x, by = stats::setNames(keys$x, keys$y))) stats <- list( @@ -136,4 +139,3 @@ log_join <- function(x, y, by, .fun, .funname, ...) { newdata } - diff --git a/man/inner_join.Rd b/man/inner_join.Rd index 90a7655..62beeff 100644 --- a/man/inner_join.Rd +++ b/man/inner_join.Rd @@ -40,7 +40,10 @@ that prints information about the operation } \examples{ left_join(dplyr::band_members, dplyr::band_instruments, by = "name") -#> left_join: added 0 rows and added one column (plays) -full_join(dplyr::band_members, dplyr::band_instruments, by = "name") -#> full_join: added one row and added one column (plays) +#> left_join: added one column (plays) +#> > rows only in x 1 +#> > rows only in y (1) +#> > matched rows 2 +#> > === +#> > rows total 3 }