R link between tables by date.frame

Asked

Viewed 39 times

0

Hello! I have two tables in the database and they are linked by a FK, as I create a third data.frame with the data of both tables linked by FK.

I mean, I have:

dataframe1 <- tbl(con, "TabelaLegado1")
dataframe1 <- as_tibble(dataframe1  %>% select(id, nome))

dataframe2 <- tbl(con, "TabelaLegado2")
dataframe2 <- as_tibble(dataframe2  %>% select(id, texto, id_tabela_legado1))

I need to take the "name" of Tabelalegado1 and the id, text of Tabelalegado2, in a Tabelalegado3, and that these two tables are linked by the id of Tabelalegado1, and the id_tabela_legado1 of Tabelalegado2 to bring the right data to this third table.

  • 3

    Can be with R base help('merge') or with help('dplyr::left_join') (or inner_join, right_join, etc). It is hard to say without seeing the data.

  • Thank you very much!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.