Skip to content

Commit

Permalink
Merge pull request #62 from randrescastaneda:remove_key
Browse files Browse the repository at this point in the history
Remove key
  • Loading branch information
randrescastaneda authored May 17, 2024
2 parents 7c157e2 + 2c999f9 commit e3b3475
Show file tree
Hide file tree
Showing 13 changed files with 165 additions and 100 deletions.
13 changes: 4 additions & 9 deletions R/joyn-merge.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
#' will be added to the original name to distinguish from the resulting
#' variable in the joined table.
#' @param sort logical: If TRUE, sort by key variables in `by`. Default is
#' TRUE.
#' FALSE.
#' @param allow.cartesian logical: Check documentation in official [web
#' site](https://rdatatable.gitlab.io/data.table/reference/merge.html/).
#' Default is `NULL`, which implies that if the join is "1:1" it will be
Expand Down Expand Up @@ -166,7 +166,7 @@ joyn <- function(x,
reporttype = c("character", "numeric"),
roll = NULL,
keep_common_vars = FALSE,
sort = TRUE,
sort = FALSE,
verbose = getOption("joyn.verbose"),
suffixes = getOption("joyn.suffixes"),
allow.cartesian = deprecated(),
Expand Down Expand Up @@ -309,7 +309,8 @@ joyn <- function(x,
y = y,
by = by,
match_type = match_type,
suffixes = suffixes
suffixes = suffixes,
sort = sort
)

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -429,12 +430,6 @@ joyn <- function(x,
.xreport = NULL,
.yreport = NULL)


if (sort) {
setorderv(x, by, na.last = na.last)
setattr(x, 'sorted', by)
}

## Rename by variables -----

if (!is.null(fixby$xby)) {
Expand Down
8 changes: 6 additions & 2 deletions R/joyn_workhorse.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#' "1:m", "m:1", or "m:m". If "m:m" then executes `data.table::merge.data.table`
#' in the backend, otherwise uses `collapse::join()`
#' @param suffixes atomic character vector: give suffixes to columns common to both
#' @param sort logical: sort the result by the columns in `by`
#' `x` and `y`
#' @return data object of same class as `x`
#' @keywords internal
Expand All @@ -30,6 +31,7 @@ joyn_workhorse <- function(
y,
by = intersect(names(x), names(y)),
match_type = c("1:1"),
sort = FALSE,
suffixes = getOption("joyn.suffixes") # data.table suffixes
) {

Expand Down Expand Up @@ -80,7 +82,7 @@ joyn_workhorse <- function(
y = y,
by = by,
all = TRUE,
sort = FALSE,
sort = sort,
suffixes = suffixes,
allow.cartesian = TRUE
)
Expand All @@ -94,6 +96,7 @@ joyn_workhorse <- function(
validate = "m:m", # no checks performed
suffix = suffixes, # data.table suffixes
keep.col.order = TRUE,
sort = sort,
verbose = 0,
column = NULL)
}
Expand Down Expand Up @@ -132,7 +135,7 @@ joyn_workhorse <- function(
y = y,
by = by,
all = TRUE,
sort = FALSE,
sort = sort,
suffixes = suffixes,
allow.cartesian = TRUE
) |>
Expand All @@ -147,6 +150,7 @@ joyn_workhorse <- function(
validate = "m:m", # no checks performed
suffix = suffixes, # data.table suffixes
keep.col.order = TRUE,
sort = sort,
verbose = 0,
column = NULL) |>
suppressWarnings()
Expand Down
2 changes: 1 addition & 1 deletion man/anti_join.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/full_join.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/inner_join.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/joyn.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion man/joyn_workhorse.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/left_join.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/right_join.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e3b3475

Please sign in to comment.