Rows manipulation in dplyr

Hi,

I would like to learn what does rows_update and family do and where is it useful to apply it ?
My question is based on this link too:
https://stackoverflow.com/questions/71903955/in-r-how-to-combine-two-dataframes-while-there-are-multiple-lists-that-need-to

Reply that was given by user onyambu works on SO:

dplyr::rows_update(dfA, dfB, c('City', 'Name'))

but when I have tried that, it gives me an error:

Error in `dplyr::rows_update()`:
! All columns specified through `by` must exist in `x` and `y`.
ℹ The following columns are missing from `x`: `City` and `Name`.

Why is that ? Any help would be much appreciated, thank you.

That family of functions are the equivalent to INSERT , UPDATE , and DELETE in SQL. They are used to add, update or delete records in one data frame with information coming from another data frame with the same key identifier and column names.

If you are using the example data sets from your link, dfA does not have a "Gavin". You are trying to update a not-existent record.

See rows_upsert

It looks like that example works on SO, am I missing something that gives me an error ?

This topic was automatically closed 42 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.