I've looked around and I can't find a simple answer to this. How do I do what in SQL would be an update table? For example:
> df1 = data.frame(id=seq(1:3), v1=c("a", "b", NA))
> df1
id v1
1 1 a
2 2 b
3 3 <NA>
> df2 = data.frame(id=seq(1:3), v2=c("z", "y", "c"))
> df2
id v2
1 1 z
2 2 y
3 3 c
How do I update df1 with values from v2 in v1, but only when id matches and when id > 2? I've looked at data.table, but can't figure out the := syntax, and hoping there is something simple in base R? Desired output would be:
> df1
id v1
1 1 a
2 2 b
3 3 c