Import data

# excel file
data <- read_excel("../00_data/MyData.xlsx")
data
## # A tibble: 1,155 × 13
##    movie_name    release_year director age_difference couple_number actor_1_name
##    <chr>                <dbl> <chr>             <dbl>         <dbl> <chr>       
##  1 Venus                 2006 Roger M…             50             1 Peter O'Too…
##  2 The Quiet Am…         2002 Phillip…             49             1 Michael Cai…
##  3 The Big Lebo…         1998 Joel Co…             45             1 David Huddl…
##  4 Poison Ivy            1992 Katt Sh…             42             1 Tom Skerritt
##  5 Whatever Wor…         2009 Woody A…             40             1 Larry David 
##  6 Entrapment            1999 Jon Ami…             39             1 Sean Connery
##  7 Husbands and…         1992 Woody A…             38             1 Woody Allen 
##  8 Magnolia              1999 Paul Th…             38             1 Jason Robar…
##  9 Indiana Jone…         1989 Steven …             36             1 Sean Connery
## 10 Mr. Peabody …         1948 Irving …             36             1 William Pow…
## # ℹ 1,145 more rows
## # ℹ 7 more variables: actor_2_name <chr>, character_1_gender <chr>,
## #   character_2_gender <chr>, actor_1_birthdate <dttm>,
## #   actor_2_birthdate <dttm>, actor_1_age <dbl>, actor_2_age <dbl>

Apply the following dplyr verbs to your data

Filter rows

filter(data, age_difference == 30)
## # A tibble: 8 × 13
##   movie_name     release_year director age_difference couple_number actor_1_name
##   <chr>                 <dbl> <chr>             <dbl>         <dbl> <chr>       
## 1 A View to a K…         1985 John Gl…             30             1 Roger Moore 
## 2 Enemy of the …         1998 Tony Sc…             30             1 Jon Voight  
## 3 For Your Eyes…         1981 John Gl…             30             1 Roger Moore 
## 4 Funny Face             1957 Stanley…             30             1 Fred Astaire
## 5 Houseboat              1958 Melvill…             30             1 Cary Grant  
## 6 Kindergarten …         2016 Don Mic…             30             1 Dolph Lundg…
## 7 Sabrina                1954 Billy W…             30             1 Humphrey Bo…
## 8 The Quiet Ame…         1958 Joseph …             30             2 Michael Red…
## # ℹ 7 more variables: actor_2_name <chr>, character_1_gender <chr>,
## #   character_2_gender <chr>, actor_1_birthdate <dttm>,
## #   actor_2_birthdate <dttm>, actor_1_age <dbl>, actor_2_age <dbl>

Arrange rows

arrange(data, age_difference)
## # A tibble: 1,155 × 13
##    movie_name    release_year director age_difference couple_number actor_1_name
##    <chr>                <dbl> <chr>             <dbl>         <dbl> <chr>       
##  1 Daddy's Litt…         2007 Tyler P…              0             1 Idris Elba  
##  2 Red Riding H…         2011 Catheri…              0             1 Shiloh Fern…
##  3 The Hunger G…         2013 Francis…              0             1 Liam Hemswo…
##  4 Blue Valenti…         2010 Derek C…              0             1 Michelle Wi…
##  5 Catch Me If …         2002 Steven …              0             1 Amy Adams   
##  6 Good Will Hu…         1997 Gus Van…              0             1 Minnie Driv…
##  7 Killing Me S…         2002 Chen Ka…              0             1 Heather Gra…
##  8 She's Out of…         2010 Jim Fie…              0             1 Alice Eve   
##  9 Speed                 1994 Jan de …              0             1 Sandra Bull…
## 10 The Lake Hou…         2006 Alejand…              0             1 Sandra Bull…
## # ℹ 1,145 more rows
## # ℹ 7 more variables: actor_2_name <chr>, character_1_gender <chr>,
## #   character_2_gender <chr>, actor_1_birthdate <dttm>,
## #   actor_2_birthdate <dttm>, actor_1_age <dbl>, actor_2_age <dbl>

Select columns

Add columns

Summarize by groups