Joining tables

Finally, there are a few helpful functions to merge tibble. Various types of joins are supportedfor example, inner_join, left_join, and right_join. The main difference among these is related to which rows are kept from two tibble in the event there is no match.

An example of left_join has been provided here for reference. More exhaustive treatment of these join types is available online:

astate <- tibble(Name=state.name, Abbr=state.abb) 
astate 
 
tstate %>% left_join(astate, by="Name") 

The output of the preceding code is as follows:

Note that the Abbr column has been added on the right.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.98.148