Creating a new table column based on data from another table

Hello,

I'm kinda new to RStudio and I'm struggling with something. My problem is the following : basically I have 2 tables, let's say, A and B :

(Quick summary of what I want to do above.)

With those two, I just want to "append" in the column "2nd code" of table A the data of the table B based on the number associated with the "code".

(For example, Code 1308 in B is associated to number 145, so I'll put "next to" number 1308 in table A the number 145. Numbers that do not have a "2nd code" stay with the "NA".)

Those tables are just for example, the real ones contain millions of rows, that's why I'm struggling to find an easy solution. I was doing it with excel with the "function" INDEX and EQUIV but I don't really know how to do it in R.

Thanks in advance for your help !

You can use tidyr::rows_update() function

If you need more specific help, please provide a proper REPRoducible EXample (reprex) illustrating your issue.

I'll check that and I'll come back later if needed ! Thanks a lot !

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.