Learn
Joining Tables in R
Inner Join II

In addition to using inner_join() to join two data frames together, we can use the pipe %>% to join multiple data frames together at once. The following command would join orders with customers, and then join the resulting data frame with products:

big_df <- orders %>% inner_join(customers) %>% inner_join(products)

Instructions

1.

We have some more data from Cool T-Shirts Inc. The number of men’s and women’s t-shirts sold per month is in a file called men_women_sales.csv. Load this data into a data frame called men_women, and inspect it using head().

2.

Join all three data frames (sales, targets, and men_women) into one big data frame called all_data. View all_data.

3.

Cool T-Shirts Inc. thinks that they have more revenue in months where they sell more women’s t-shirts.

Filter the rows of all_data to only include rows where:

  • revenue is greater than target

AND

  • women is greater than men

Save your answer to the variable results, and view it.

Folder Icon

Take this course for free

Already have an account?