0
Rapazeada blz?
Guy I am Newbie in R and I wonder if it is possible to update a data.frame in R by making key with another data.frame, the analogy in tsql would be this:
Update a Set a.col1 = b.col2 From tb1 to Join tb2 b On a.Chave1 = b.Chave2
Is there any function that would do that in R?
Inside the structure: tb1$col1 <- ....
Ex:
TABLES
df1 <- data.frame(Chave1 = c('A', 'A', 'C', ’D', 'E'), values1 = c('high', 'medium', 'high', 'high', 'low'))
Chave1 value 1 1 high 2 to medium 3 C high 4 D high 5 and low
df2 <- data.frame(Chave2 = c('A', 'E', 'C'), values2 = c('rich', 'Poble', 'average'))
Chave2 values2 1 A rich 2 and Poble 3 C average
RESULT
Chave1 value 1 1 A rich 2 A rich 3 C average 4 D NA 5 and Poble
Possible duplicate of How to merge multiple dates frames into one
– Flavio Barros