I have a tibbles that look like this:
B C D E F G
1 260-098 260-073 260-051 260-057 260-055 260-009
2 260-098 260-073 260-051 260-057 260-055 260-009
3 260-098 260-009 260-051 260-057 260-055 260-005
and I have a database table that contains the following:
roomID rnumber
1 1 260-005
2 2 260-009
3 3 260-051
4 4 260-055
5 5 260-057
6 6 260-073
7 7 260-098
I would like to replace the entries of the tibble with the matching roomID. I thought I could do it with mutate_all
, e.g.
mutate_all(function(x){
as_tibble(x) %>%
left_join(roomTbl, by = c("x" = "rnumber")) %>%
select(roomID)
})
but I don't know what to use as the name of the anonymous column in the join. I have tried replacing "x"
with names(x)
but R does not like it.