O'Reilly logo

Data Analysis with R - Second Edition by Tony Fischetti

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Joining data

Luckily, we have already spoke at length of the basics of joining/merging s in the last section so we can jump right into how to actually perform them here.

Joining data sets in dplyr could scarcely be simpler! Just as in the last section, let’s inner join the tracks tibble and the with the artist info (including country of origin), using the following code:

> # download the artist info > download.file("https://raw.githubusercontent.com/tonyfischetti/dawr/master/working-with-packages/data/artist-info.txt", "./artist-info.txt"> artistinfo <- read_delim("./artist-info.txt", delim="\t")>> tmp <- tracks %>% inner_join(artistinfo)Joining, by = “mbid”> tmp %>% nrow[1] 122241

How simple is that!?

There are two things I’d like to point ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required