Hello everyone,
I need to replace some value of a tibble based on another tibble while the index number or row value is matching. Lets see the problems below.
tibble1 <- tibble(a = c(1,2,3,4), b = c(0,0,0,0))
tibble2 <- tibble(a = c(2,4), b = c(53,98))
Here are two tibbles. The resultant of the operation should look like below.
# A tibble: 4 × 2
a b
<dbl> <dbl>
1 1 0
2 2 53
3 3 0
4 4 98
But the condition is the problem should be solved without using any loop. Is there any other ways or any base R built-in functions to solve the issue.
Thanks in advance.