Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@

10. `fread()` no longer misreads dates with negative years, [#7704](https://github.com/Rdatatable/data.table/issues/7704). Thanks to @kevinushey for the report and @aitap for the fix.

11. `.NAUTRAL` now unpacks early enough to detect common columns, the same as `on=` join, [#6667] (https://github.com/Rdatatable/data.table/issues/6667). Thanks you @MichaelChirico for the report and @aam936 for the fix.


### Notes

1. {data.table} now depends on R 3.5.0 (2018).
Expand Down
8 changes: 6 additions & 2 deletions R/data.table.R
Original file line number Diff line number Diff line change
Expand Up @@ -845,10 +845,14 @@
stopf("When i is a data.table (or character vector), the columns to join by must be specified using the 'on=' argument (see ?data.table); by keying x (i.e., x is sorted and marked as such, see ?setkey); or by using 'on = .NATURAL' to indicate using the shared column names between x and i (i.e., a natural join). Keyed joins might have further speed benefits on very large data due to x being sorted in RAM.")
}
} else if (identical(substitute(on), as.name(".NATURAL"))) {
naturaljoin = TRUE
}
common_names = intersect(names_x, names(i))

Check warning on line 848 in R/data.table.R

View workflow job for this annotation

GitHub Actions / lint-r

file=R/data.table.R,line=848,col=1,[whitespace_linter] Use spaces to indent, not tabs.
if (!length(common_names))

Check warning on line 849 in R/data.table.R

View workflow job for this annotation

GitHub Actions / lint-r

file=R/data.table.R,line=849,col=1,[whitespace_linter] Use spaces to indent, not tabs.
stopf("Attempting to do natural join but no common columns in provided tables")

Check warning on line 850 in R/data.table.R

View workflow job for this annotation

GitHub Actions / lint-r

file=R/data.table.R,line=850,col=1,[whitespace_linter] Use spaces to indent, not tabs.
on = common_names

Check warning on line 851 in R/data.table.R

View workflow job for this annotation

GitHub Actions / lint-r

file=R/data.table.R,line=851,col=1,[whitespace_linter] Use spaces to indent, not tabs.
}

Check warning on line 852 in R/data.table.R

View workflow job for this annotation

GitHub Actions / lint-r

file=R/data.table.R,line=852,col=1,[whitespace_linter] Use spaces to indent, not tabs.
if (naturaljoin) { # natural join #629
common_names = intersect(names_x, names(i))
print(common_names)

Check warning on line 855 in R/data.table.R

View workflow job for this annotation

GitHub Actions / lint-r

file=R/data.table.R,line=855,col=1,[whitespace_linter] Use spaces to indent, not tabs.
len_common_names = length(common_names)
if (!len_common_names) stopf("Attempting to do natural join but no common columns in provided tables")
if (verbose) {
Expand Down
Loading