0

I want to join table RD and table POOL with left single match join to keep the same number of rows of my left table (RD) into the new generated table newRD.

I succeed to have left join with below R basic code but not the single match.

newRD <- merge(RD, POOL, by.x=c(rdrefid), by.y=c(poolid),all.x=TRUE)

Spotfire permit to do it as follows but I would like to have all data base management embedded into a basic R script.

RD Table

POOL table

Use of the Spotfire Insert > Columns function Spotfire - Insert Column

NewRD table

  • 1
    Check out [this](https://stackoverflow.com/questions/37749412/select-only-the-first-row-when-merging-data-frames-with-multiple-matches) answer – Humpelstielzchen May 29 '19 at 06:53
  • I'm not familiar with the use of `match=` as an argument to `merge`. Is there another package you're using here? (In this case, I suspect that there is an error, `object 'first' not found`, since this syntax suggests you are trying to pass an object as an argument. (If this is some non-base version of `merge`, perhaps you mean `match="first"`? If this is `base::merge`, then, well I don't know that arg.) – r2evans May 29 '19 at 06:54
  • 1
    It might be useful if we see a representative (and functional) sample of each of your frames, `RD` and `POOL`. If they are complex and/or proprietary, please consider reproducing your issues with public datasets (e.g., `mtcars`, `iris`, `ggplot2::diamonds`), or even better: make the programmatically with `data.frame(...)` and a few rows, few columns each. – r2evans May 29 '19 at 06:56

0 Answers0