merge.data.table throws error for `<` in variable names

Open
#2,140 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
r
Domain
data

Research direction

Start by reproducing the example with merge.data.table on a data.table whose variable name contains angle brackets, then inspect the reported [.data.table lookup failure. Done means either merging succeeds for these names or the error message clearly explains that angle brackets are unsupported; compare with the data.frame behavior shown in the issue.

Written by the indexing model from the issue text.

Description

enhancement joins

an error is thrown if one wants to merge a data.table with < or > in its variable names.

> dt <- data.table('x <TBD>' = 1:2)
> merge(dt, dt)
Error in `[.data.table`(y, x, nomatch = if (all.x) NA else 0, on = by,  : Column(s) [x ] not found in x

using merge(dt, dt, by = 'x <TBD>') results in the same error. If angle brackets are not supported by data.table, I would suggest adapting the error message.

sidenote: this works with data.frames

> df <- data.frame('x <TBD>' = 1:2)
> merge(df, df)
  x..TBD.
1       1
2       2
Dominant language
R
Stars
3.9k
Forks
1.1k
Avg merge
14h 4m
Merged PRs (30d)
4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Rdatatable/data.table

All issues in Rdatatable/data.table

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.