Given 2 data frames that are identical in terms of column names/datatypes, where some columns uniquely identify the rows, is there an efficient function/method for one data.
I'd use data.table
objects. This code seems to work on your example:
library(data.table)
# set keys
original.dt <- data.table(original, key=c("Name", "Id"))
replacement.dt <- data.table(replacement, key=c("Name", "Id"))
goal2 <- original.dt
# subset and reassign
# goal2[replacement.dt[, list(Name, Id)]] <- replacement.dt
goal2[replacement.dt] <- replacement.dt # cleaner and faster, see Matthew's comment
goal2 <- as.data.frame(goal2)
identical(goal, goal2) # FALSE, why? See Joris's comment
all.equal(goal, goal2) # TRUE