Skip to content

Instantly share code, notes, and snippets.

@anirudhjayaraman
Created December 18, 2015 12:44
Show Gist options
  • Save anirudhjayaraman/48a6e6af93e1be166c0f to your computer and use it in GitHub Desktop.
Save anirudhjayaraman/48a6e6af93e1be166c0f to your computer and use it in GitHub Desktop.
# Summarizing Exercise
# Select the flights that had JFK as their destination: c1
c1 <- filter(hflights, Dest == 'JFK')
# Combine the Year, Month and DayofMonth variables to create a Date column: c2
c2 <- mutate(c1, Date = paste(Year, Month, DayofMonth, sep = "-"))
# Print out a selection of columns of c2
select(c2, Date, DepTime, ArrTime, TailNum)
# How many weekend flights flew a distance of more than 1000 miles
# but had a total taxiing time below 15 minutes?
nrow(filter(hflights, DayOfWeek %in% c(6,7), Distance > 1000, TaxiIn + TaxiOut < 15))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment